mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 23:00:39 +02:00
feat: switch to numtide devshell; unify user stateVersion and system stateVersion
This commit is contained in:
parent
b5563fa841
commit
919381aa87
4 changed files with 102 additions and 16 deletions
43
flake.lock
generated
43
flake.lock
generated
|
@ -152,6 +152,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1693818812,
|
||||
"narHash": "sha256-KlLB94/Rt4l8/gdTOsSB5+YtsfKUqLTuM/DcsdpliLo=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "c6add4ff593de4ce67095e500a5e3113636da839",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -262,7 +283,7 @@
|
|||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
|
@ -280,7 +301,7 @@
|
|||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1687709756,
|
||||
|
@ -298,7 +319,7 @@
|
|||
},
|
||||
"flake-utils_3": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1692799911,
|
||||
|
@ -606,6 +627,7 @@
|
|||
"agenix": "agenix",
|
||||
"agenix-rekey": "agenix-rekey",
|
||||
"colmena": "colmena",
|
||||
"devshell": "devshell",
|
||||
"disko": "disko",
|
||||
"elewrap": "elewrap",
|
||||
"flake-utils": "flake-utils_3",
|
||||
|
@ -709,6 +731,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_4": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"templates": {
|
||||
"locked": {
|
||||
"lastModified": 1691421369,
|
||||
|
|
64
flake.nix
64
flake.nix
|
@ -8,6 +8,11 @@
|
|||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
|
||||
devshell = {
|
||||
url = "github:numtide/devshell";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
disko = {
|
||||
url = "github:nix-community/disko";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -74,6 +79,7 @@
|
|||
self,
|
||||
agenix-rekey,
|
||||
colmena,
|
||||
devshell,
|
||||
elewrap,
|
||||
flake-utils,
|
||||
microvm,
|
||||
|
@ -136,6 +142,7 @@
|
|||
++ [
|
||||
microvm.overlay
|
||||
elewrap.overlays.default
|
||||
devshell.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -174,21 +181,56 @@
|
|||
};
|
||||
|
||||
# `nix develop`
|
||||
devShells.default = pkgs.mkShell {
|
||||
devShells.default = pkgs.devshell.mkShell {
|
||||
name = "nix-config";
|
||||
packages = with pkgs; [
|
||||
# Nix
|
||||
alejandra
|
||||
cachix
|
||||
deadnix
|
||||
nix-tree
|
||||
statix
|
||||
update-nix-fetchgit
|
||||
nix # Always use the nix version from this flake's nixpkgs versios, so that nix-plugins (below) doesn't fail because of different nix versions.
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
${self.checks.${system}.pre-commit-hooks.shellHook}
|
||||
'';
|
||||
commands = with pkgs; [
|
||||
{
|
||||
package = colmena.packages.${system}.colmena;
|
||||
help = "Build and deploy this nix config to nodes";
|
||||
}
|
||||
{
|
||||
package = alejandra;
|
||||
help = "Format nix code";
|
||||
}
|
||||
{
|
||||
package = statix;
|
||||
help = "Lint nix code";
|
||||
}
|
||||
{
|
||||
package = deadnix;
|
||||
help = "Find unused expressions in nix code";
|
||||
}
|
||||
{
|
||||
package = update-nix-fetchgit;
|
||||
help = "Update fetcher hashes inside nix files";
|
||||
}
|
||||
{
|
||||
package = nix-tree;
|
||||
help = "Interactively browse dependency graphs of Nix derivations";
|
||||
}
|
||||
{
|
||||
package = nix-diff;
|
||||
help = "Explain why two Nix derivations differ";
|
||||
}
|
||||
];
|
||||
|
||||
devshell.startup.pre-commit.text = self.checks.${system}.pre-commit-hooks.shellHook;
|
||||
|
||||
env = [
|
||||
{
|
||||
# Additionally configure nix-plugins with our extra builtins file.
|
||||
# We need this for our repo secrets.
|
||||
name = "NIX_CONFIG";
|
||||
value = ''
|
||||
plugin-files = ${pkgs.nix-plugins}/lib/nix/plugins
|
||||
extra-builtins-file = ${self.outPath}/nix/extra-builtins.nix
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# `nix fmt`
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
{
|
||||
{config, ...}: {
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
verbose = true;
|
||||
sharedModules = [
|
||||
{
|
||||
home.stateVersion = config.system.stateVersion;
|
||||
}
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
nixosConfig = config;
|
||||
};
|
||||
};
|
||||
|
||||
# Required even when using home-manager's zsh module since the /etc/profile load order
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
];
|
||||
|
||||
home = {
|
||||
inherit (config.system) stateVersion;
|
||||
inherit (config.users.users.root) uid;
|
||||
username = config.users.users.root.name;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue