refactor flake

This commit is contained in:
2026-04-20 20:01:16 +02:00
parent 23342a1bf5
commit a7ecd6f3ab
2 changed files with 66 additions and 48 deletions

64
flake.lock generated
View File

@@ -18,19 +18,36 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1775087534,
"narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1762844143, "lastModified": 1776705249,
"narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=", "narHash": "sha256-3cg0CfzLLq2ay8SzAoNbI2OJkWY1H3kudrzA6hL14FM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4", "rev": "cc3f2ee0b3909e42334f34720ccac109a7e67068",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4",
"type": "github" "type": "github"
} }
}, },
@@ -49,10 +66,47 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1774748309,
"narHash": "sha256-+U7gF3qxzwD5TZuANzZPeJTZRHS29OFQgkQ2kiTJBIQ=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "333c4e0545a6da976206c74db8773a1645b5870a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"wildfly": "wildfly"
}
},
"wildfly": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1776706386,
"narHash": "sha256-en72yqmDrm20Q+W0COp9I+Lc4j8NdeqKuGmYuZeD/yQ=",
"owner": "0qln",
"repo": "wildfly",
"rev": "87fdb70a9877ee697790f8e2edfda4bd3091616b",
"type": "github"
},
"original": {
"owner": "0qln",
"repo": "wildfly",
"type": "github"
} }
} }
}, },

View File

@@ -3,21 +3,18 @@
inputs = { inputs = {
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4"; nixpkgs.url = "github:NixOS/nixpkgs";
wildfly = {
url = "github:0qln/wildfly";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = inputs @ { outputs = inputs @ {flake-parts, ...}:
flake-parts,
self,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake {inherit inputs;} {
imports = []; imports = [];
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = { perSystem = {
config,
self',
inputs',
pkgs, pkgs,
system, system,
... ...
@@ -50,40 +47,7 @@
])) ]))
]; ];
wildfly = pkgs.stdenvNoCC.mkDerivation { wildfly-fhs = inputs.wildfly.packages.${system}.wildfly-fhs;
name = "wildfly-39.0.0.Final";
src = pkgs.fetchzip {
url = "https://github.com/wildfly/wildfly/releases/download/39.0.0.Final/wildfly-39.0.0.Final.zip";
hash = "sha256-nfdb4doRRn4AwMQZkNYwIDBKIq4iY6diFX/WlPFQqZI=";
};
installPhase = ''
mkdir -p $out
cp -r $src/* $out/
'';
};
wildfly-fhs = pkgs.buildFHSEnv {
name = "wildfly-fhs";
targetPkgs = pkgs:
with pkgs; [
openjdk21
bash
coreutils
];
runScript = "${wildfly}/bin/standalone.sh";
profile =
# bash
''
export WILDFLY_BASE_DIR="$HOME/.wildfly-fhs-base"
mkdir -p "$WILDFLY_BASE_DIR"/{log,data,deployments,tmp,configuration}
if [ ! -f "$WILDFLY_BASE_DIR/configuration/standalone.xml" ]; then
cp -r ${wildfly}/standalone/configuration/* "$WILDFLY_BASE_DIR/configuration/"
chmod -R u+w "$WILDFLY_BASE_DIR/configuration/"
fi
export JBOSS_HOME=${wildfly}
export JBOSS_BASE_DIR="$WILDFLY_BASE_DIR"
'';
};
in { in {
# Per-system attributes can be defined here. The self' and inputs' # Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same # module parameters provide easy access to attributes of the same