replace flake-utils with flake-parts

This commit is contained in:
Felix Buehler 2022-06-26 22:40:59 +02:00
parent 819c842620
commit 48d6936889
4 changed files with 85 additions and 75 deletions

65
flake.lock generated
View file

@ -59,18 +59,23 @@
"type": "github"
}
},
"flake-utils": {
"flake-parts": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1656065134,
"narHash": "sha256-oc6E6ByIw3oJaIyc67maaFcnjYOz1mMcOtHxbEf9NwQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "bee6a7250dd1b01844a2de7e02e4df7d8a0a206c",
"lastModified": 1655983956,
"narHash": "sha256-2h986XafeFMRuIVy3CjfVgzz0cqYbaxfXzcqeCCGqEU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9b0000f75f6a53c0814264e27ca32f4bddeb15cc",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
@ -97,11 +102,11 @@
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
"lastModified": 1656108215,
"narHash": "sha256-RzgcfbXxNWtt4BeJ/rPzHxR+l+wCfiauN4XTVnRLiy0=",
"lastModified": 1656184677,
"narHash": "sha256-hFj9zDltmwb/ZUUfmUyVnFzW5uU3Lpr2n4lo3drp+S4=",
"owner": "NixOS",
"repo": "nix",
"rev": "586fa707fca207dbd12e49800691390249bdcd03",
"rev": "49c4a37efc23bf16f40e23b3722503a3678e7031",
"type": "github"
},
"original": {
@ -112,11 +117,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1655789751,
"narHash": "sha256-DbL2gn7YwkuX10OdlWfZ/A7zEJztwHh9NMeau1JMTdk=",
"lastModified": 1656241064,
"narHash": "sha256-+jWwBt515aFGukeX8WSafg9CM3Ju3FD0XrF+X4ph0mU=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "f9d8dff4e621f2d7f2b84d9e84bc6359715f971c",
"rev": "99e33a57149916ebede78ec13edd9ba310c10f2f",
"type": "github"
},
"original": {
@ -142,11 +147,11 @@
},
"nixpkgs-21_11": {
"locked": {
"lastModified": 1655562720,
"narHash": "sha256-OrN8DkBRZqZMzMuECuQNvSQ5gWoFBCxDvxYXjIQ/pH0=",
"lastModified": 1656198488,
"narHash": "sha256-xe81o3Kin6a0jXA3mTxcR+jeA1jLKw3TCar5LUo/B5c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "27dffce7eaa9648b4a13a461e786f169a17c0889",
"rev": "46af3303651699dc58cfc251d9b18c0f59d857da",
"type": "github"
},
"original": {
@ -158,11 +163,11 @@
},
"nixpkgs-22_05": {
"locked": {
"lastModified": 1655584987,
"narHash": "sha256-YmWxPm6ctu+9nV80DtYtMfOBosNymeTpj8+Z0JTDfhU=",
"lastModified": 1656199498,
"narHash": "sha256-/BCpM7j7y1G4het6Z3idlnv9A87/s0O1glVmH7fnWvk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "57622cb817210146b379adbbd036d3da0d1f367c",
"rev": "72a1f167077060a1a7b6e0104863245d0483fa7f",
"type": "github"
},
"original": {
@ -190,11 +195,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1655983783,
"narHash": "sha256-0h1FzkYWei24IdKNpCX93onkF/FMiXQG8SdEbTc0r8A=",
"lastModified": 1656239181,
"narHash": "sha256-wW1xRFBn376yGloXZ4QzBE4hjipMawpV18Lshd9QSPw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6141b8932a5cf376fe18fcd368cecd9ad946cb68",
"rev": "f2537a505d45c31fe5d9c27ea9829b6f4c4e6ac5",
"type": "github"
},
"original": {
@ -236,11 +241,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1655481042,
"narHash": "sha256-XHbcywq2vIQ5CeH1OK3TN793jkiNAAZsSctS1PFgseo=",
"lastModified": 1656130826,
"narHash": "sha256-g5Wo75ddDQmWnL70rJCMm+JJlvHbzPFUePUpuMNn5qk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "103a4c0ae46afa9cf008c30744175315ca38e9f9",
"rev": "72d1b0d0fac131df1ea254b65413c85609bdd2ee",
"type": "github"
},
"original": {
@ -253,7 +258,7 @@
"root": {
"inputs": {
"deploy-rs": "deploy-rs",
"flake-utils": "flake-utils",
"flake-parts": "flake-parts",
"nix": "nix",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_3",
@ -286,11 +291,11 @@
"nixpkgs-22_05": "nixpkgs-22_05"
},
"locked": {
"lastModified": 1655707707,
"narHash": "sha256-PlDTG9w4FtoqnELKC+FYS2d2XCG/HGpBMqDX+V98pu4=",
"lastModified": 1656215886,
"narHash": "sha256-67fkBb4GUbuMZTHs08mNycg0hBzboy+5boMD76wLpj4=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "2a8d731e401889bd3e03b40da50f7314dee4a4da",
"rev": "aff5d8542c9eb566a000302b22fcc10715bc2feb",
"type": "github"
},
"original": {

View file

@ -1,7 +1,8 @@
{
description = "NixOS configuration";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs.follows = "nixpkgs";
nix.url = "github:NixOS/nix";
nixpkgs.url = "nixpkgs/nixos-22.05";
@ -18,5 +19,23 @@
flake = false;
};
};
outputs = { ... } @ args: import ./outputs.nix args;
outputs = { self, flake-parts, deploy-rs, ... } @ inputs:
flake-parts.lib.mkFlake { inherit self; } {
imports = [
./nixos/configurations.nix
#./nixos/images/default.nix
./shell.nix
];
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = {inputs', ...}: {
# make pkgs available to all `perSystem` functions
_module.args.pkgs = inputs'.nixpkgs.legacyPackages;
};
flake = {
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
deploy = import ./nixos/deploy.nix (inputs // {
inherit inputs;
});
};
};
}

View file

@ -1,28 +0,0 @@
{ self
, flake-utils
, nixpkgs
, nixpkgs-unstable
, sops-nix
, deploy-rs
, ...
} @ inputs:
(flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
in
{
devShells."${system}".default = import ./shell.nix ( inputs // {
inherit (sops-nix.packages."${pkgs.system}") sops-import-keys-hook;
inherit (deploy-rs.packages."${pkgs.system}") deploy-rs;
});
})) // {
nixosConfigurations = import ./nixos/configurations.nix (inputs // {
inherit inputs;
});
deploy = import ./nixos/deploy.nix (inputs // {
inherit inputs;
});
hydraJobs = nixpkgs.lib.mapAttrs' (name: config: nixpkgs.lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel) self.nixosConfigurations;
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
}

View file

@ -1,17 +1,31 @@
{ mkShellNoCC
, ssh-to-age
, sops
, sops-import-keys-hook
, deploy-rs
, nixpkgs-fmt
}:
#{ mkShellNoCC
#, ssh-to-age
#, sops
#, sops-import-keys-hook
#, deploy-rs
#, nixpkgs-fmt
#}:
#
#mkShellNoCC {
# nativeBuildInputs = [
# ssh-to-age
# sops
# sops-import-keys-hook
# deploy-rs
# nixpkgs-fmt
# ];
#}
mkShellNoCC {
nativeBuildInputs = [
ssh-to-age
sops
sops-import-keys-hook
deploy-rs
nixpkgs-fmt
];
{
perSystem = { inputs', pkgs, ... }: {
# Definitions like this are entirely equivalent to the ones
# you may have directly in flake.nix.
devShells.default = pkgs.mkShellNoCC {
nativeBuildInputs = [
inputs'.sops-nix.packages.sops-import-keys-hook
inputs'.deploy-rs.packages.deploy-rs
pkgs.nixpkgs-fmt
];
};
};
}