Compare commits

...

1 Commits

Author SHA1 Message Date
Tudor Roman cb7de30630
abandon flake-utils in favour of flake-parts 2023-12-17 16:02:08 +01:00
2 changed files with 90 additions and 107 deletions

View File

@ -132,6 +132,26 @@
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1701473968,
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1659877975,
@ -172,11 +192,11 @@
]
},
"locked": {
"lastModified": 1700392168,
"narHash": "sha256-v5LprEFx3u4+1vmds9K0/i7sHjT0IYGs7u9v54iz/OA=",
"lastModified": 1702195668,
"narHash": "sha256-Lxmjez0nfNBptdqV5GsXKm7Bb7swjGsrxiLxWJu0tL8=",
"owner": "rycee",
"repo": "home-manager",
"rev": "28535c3a34d79071f2ccb68671971ce0c0984d7e",
"rev": "33110fb3c7fe6a94b98b641866a5eddb64b7c23f",
"type": "github"
},
"original": {
@ -385,6 +405,7 @@
"co-work": "co-work",
"deploy-rs": "deploy-rs",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"hypr-contrib": "hypr-contrib",
"nixgl": "nixgl",
@ -392,9 +413,7 @@
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_4",
"site": "site",
"systems": "systems_2",
"unstable": "unstable",
"utils": "utils_6",
"yarr-nix": "yarr-nix"
}
},
@ -433,21 +452,6 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"unstable": {
"locked": {
"lastModified": 1700390070,
@ -539,26 +543,6 @@
"type": "github"
}
},
"utils_6": {
"inputs": {
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"yarr-nix": {
"inputs": {
"nixpkgs": [

133
flake.nix
View File

@ -3,10 +3,9 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
deploy-rs = {
@ -62,7 +61,7 @@
blog.url = "github:tudurom/blog";
};
outputs = { self, nixpkgs, utils, deploy-rs, unstable, ... } @ inputs:
outputs = inputs@{ self, nixpkgs, deploy-rs, unstable, flake-parts, ... }:
let
vars = {
stateVersion = "22.05";
@ -163,77 +162,77 @@
})
];
};
in
{
nixosConfigurations."ceres" = mkNixOSSystem "ceres" "x86_64-linux";
nixosConfigurations."wsl2" = mkNixOSSystem "wsl2" "x86_64-linux";
in flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
flake = {
nixosConfigurations."ceres" = mkNixOSSystem "ceres" "x86_64-linux";
nixosConfigurations."wsl2" = mkNixOSSystem "wsl2" "x86_64-linux";
homeConfigurations."tudor" = mkNonNixOSEnvironment "tudor" "tudor" "x86_64-linux";
homeConfigurations."tudor@pepper-penguin" = mkNonNixOSEnvironment "tudor@pepper-penguin" "tudor" "x86_64-linux";
packages."x86_64-linux"."tudor" = self.homeConfigurations."tudor".activationPackage;
packages."x86_64-linux"."tudor@pepper-penguin" = self.homeConfigurations."tudor@pepper-penguin".activationPackage;
packages.x86_64-linux."tudor" = self.homeConfigurations."tudor".activationPackage;
packages.x86_64-linux."tudor@pepper-penguin" = self.homeConfigurations."tudor@pepper-penguin".activationPackage;
} // {
checks = (builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib);
deploy.nodes."ceres" = {
hostname = "ceres.lamb-monitor.ts.net";
profiles.system = {
sshUser = "root";
path = (mkDeployPkgs "x86_64-linux").deploy-rs.lib.activate.nixos self.nixosConfigurations."ceres";
homeConfigurations."tudor" = mkNonNixOSEnvironment "tudor" "tudor" "x86_64-linux";
homeConfigurations."tudor@pepper-penguin" = mkNonNixOSEnvironment "tudor@pepper-penguin" "tudor" "x86_64-linux";
deploy.nodes."ceres" = {
hostname = "ceres.lamb-monitor.ts.net";
profiles.system = {
sshUser = "root";
path = (mkDeployPkgs "x86_64-linux").deploy-rs.lib.activate.nixos self.nixosConfigurations."ceres";
};
};
};
} // utils.lib.eachDefaultSystem (system: let
deployPkgs = let
pkgs = import nixpkgs { inherit system; };
in import nixpkgs {
inherit system;
overlays = [
deploy-rs.overlay
(final: prev: {
deploy-rs = { inherit (pkgs) deploy-rs; lib = prev.deploy-rs.lib; };
})
];
};
pkgs = mkPkgs nixpkgs system;
in {
apps.deploy-rs = {
type = "app";
program = "${deployPkgs.deploy-rs.deploy-rs}/bin/deploy";
};
perSystem = {config, pkgs, system, ... }: let
deployPkgs = import nixpkgs {
inherit system;
overlays = [
deploy-rs.overlay
(final: prev: {
deploy-rs = { inherit (pkgs) deploy-rs; lib = prev.deploy-rs.lib; };
})
];
};
in {
_module.args.pkgs = mkPkgs nixpkgs system;
apps.deploy-rs = {
type = "app";
program = "${deployPkgs.deploy-rs.deploy-rs}/bin/deploy";
};
packages.default = pkgs.nix;
packages.home-manager = pkgs.home-manager;
packages.nixos-rebuild = pkgs.nixos-rebuild;
packages.agenix = pkgs.agenix;
packages.default = pkgs.nix;
packages.home-manager = pkgs.home-manager;
packages.nixos-rebuild = pkgs.nixos-rebuild;
packages.agenix = pkgs.agenix;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
nix
home-manager
nixos-rebuild
agenix
deployPkgs.deploy-rs.deploy-rs
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
nix
home-manager
nixos-rebuild
agenix
deployPkgs.deploy-rs.deploy-rs
nil
];
};
nil
];
};
checks = {
ansible-lint = pkgs.stdenvNoCC.mkDerivation {
name = "run-ansible-lint";
src = ./.;
dontBuild = true;
doCheck = true;
buildInputs = with pkgs; [ ansible-lint git ];
checkPhase = ''
cd ./ansible
env "HOME=$TMPDIR" ansible-lint --offline
'';
installPhase = ''
mkdir "$out"
'';
checks = (deployPkgs.deploy-rs.lib.deployChecks self.deploy) // {
ansible-lint = pkgs.stdenvNoCC.mkDerivation {
name = "run-ansible-lint";
src = ./.;
dontBuild = true;
doCheck = true;
buildInputs = with pkgs; [ ansible-lint git ];
checkPhase = ''
cd ./ansible
env "HOME=$TMPDIR" ansible-lint --offline
'';
installPhase = ''
mkdir "$out"
'';
};
};
};
});
};
}