Refactor to flake-parts

This commit is contained in:
Oliver Davies 2025-07-09 00:23:48 +01:00
parent 17146923b4
commit c134aaeb1b
4 changed files with 122 additions and 98 deletions

25
flake.lock generated
View file

@ -83,10 +83,7 @@
}, },
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": "nixpkgs-lib"
"nixvim",
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1751413152, "lastModified": 1751413152,
@ -263,6 +260,21 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-lib": {
"locked": {
"lastModified": 1751159883,
"narHash": "sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "14a40a1d7fb9afa4739275ac642ed7301a9ba1ab",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1751274312, "lastModified": 1751274312,
@ -297,7 +309,9 @@
}, },
"nixvim": { "nixvim": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": [
"flake-parts"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
@ -366,6 +380,7 @@
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"disko": "disko", "disko": "disko",
"flake-parts": "flake-parts",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixos-wsl": "nixos-wsl", "nixos-wsl": "nixos-wsl",

191
flake.nix
View file

@ -6,6 +6,8 @@
disko.inputs.nixpkgs.follows = "nixpkgs"; disko.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko"; disko.url = "github:nix-community/disko";
flake-parts.url = "github:hercules-ci/flake-parts";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/master"; home-manager.url = "github:nix-community/home-manager/master";
@ -13,6 +15,7 @@
nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
nixvim.inputs.flake-parts.follows = "flake-parts";
nixvim.inputs.nixpkgs.follows = "nixpkgs"; nixvim.inputs.nixpkgs.follows = "nixpkgs";
nixvim.url = "github:nix-community/nixvim"; nixvim.url = "github:nix-community/nixvim";
@ -24,114 +27,118 @@
}; };
outputs = outputs =
{ nixpkgs, self, ... }@inputs: inputs@{
let flake-parts,
inherit (self) outputs; nixpkgs,
self,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
flake =
let
inherit (self) outputs;
system = "x86_64-linux"; specialArgs = {
pkgs = import nixpkgs { inherit system; }; inherit inputs outputs self;
username = "opdavies"; system = "x86_64-linux";
username = "opdavies";
};
in
{
homeManagerModules.default = import ./modules/home-manager;
specialArgs = { nixosConfigurations = {
inherit lemp11 = nixpkgs.lib.nixosSystem {
inputs modules = [
outputs ./hosts/lemp11/configuration.nix
self ];
system
username
;
};
inherit (pkgs) mkShell; specialArgs = specialArgs // {
hostname = "lemp11";
stateVersion = "22.11";
};
};
nixvim = inputs.nixvim.legacyPackages.${system}.makeNixvimWithModule { nixedo = nixpkgs.lib.nixosSystem {
inherit pkgs; modules = [
./hosts/nixedo/configuration.nix
];
module = import ./modules/home-manager/coding/neovim/config; specialArgs = specialArgs // {
}; hostname = "nixedo";
in stateVersion = "24.11";
{ };
devShells.${system}.default = pkgs.mkShell { };
packages = with pkgs; [
just
lua-language-server
lua54Packages.luacheck
nixd
];
};
packages.${system} = { t480 = nixpkgs.lib.nixosSystem {
inherit nixvim; modules = [
./hosts/t480/configuration.nix
];
default = mkShell { buildInputs = with pkgs; [ just ]; }; specialArgs = specialArgs // {
}; hostname = "t480";
stateVersion = "22.11";
};
};
formatter.${system} = pkgs.nixfmt-rfc-style; t490 = nixpkgs.lib.nixosSystem {
modules = [
./hosts/t490/configuration.nix
];
overlays = import ./overlays { inherit inputs; }; specialArgs = specialArgs // {
hostname = "t490";
stateVersion = "22.11";
};
};
homeManagerModules.default = import ./modules/home-manager; PW05CH3L = nixpkgs.lib.nixosSystem {
modules = [
./hosts/PW05CH3L/configuration.nix
];
nixosModules.default = import ./modules/nixos; specialArgs = specialArgs // {
hostname = "PW05CH3L";
stateVersion = "22.11";
};
};
};
nixosConfigurations = { nixosModules.default = import ./modules/nixos;
lemp11 = nixpkgs.lib.nixosSystem {
modules = [
./hosts/lemp11/configuration.nix
];
specialArgs = specialArgs // { overlays = import ./overlays { inherit inputs; };
hostname = "lemp11"; };
stateVersion = "22.11";
perSystem =
{ pkgs, system, ... }:
let
# TODO: refactor to use inputs' or similar.
nixvim = inputs.nixvim.legacyPackages.${system}.makeNixvimWithModule {
inherit pkgs;
module = import ./modules/home-manager/coding/neovim/config;
};
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
just
lua-language-server
lua54Packages.luacheck
nixd
];
};
formatter = pkgs.nixfmt-rfc-style;
packages = {
inherit nixvim;
default = pkgs.mkShell { buildInputs = with pkgs; [ just ]; };
}; };
}; };
nixedo = nixpkgs.lib.nixosSystem { systems = [ "x86_64-linux" ];
modules = [
./hosts/nixedo/configuration.nix
];
specialArgs = specialArgs // {
hostname = "nixedo";
stateVersion = "24.11";
};
};
t480 = nixpkgs.lib.nixosSystem {
modules = [
./hosts/t480/configuration.nix
];
specialArgs = specialArgs // {
hostname = "t480";
stateVersion = "22.11";
};
};
t490 = nixpkgs.lib.nixosSystem {
modules = [
./hosts/t490/configuration.nix
];
specialArgs = specialArgs // {
hostname = "t490";
stateVersion = "22.11";
};
};
PW05CH3L = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/PW05CH3L/configuration.nix
];
specialArgs = specialArgs // {
hostname = "PW05CH3L";
stateVersion = "22.11";
};
};
};
}; };
} }

View file

@ -19,10 +19,11 @@ in
keybindings = { keybindings = {
"{_, shift +, super +}XF86MonBrightness{Down,Up}" = "${getExe pkgs.brightnessctl} set {5%-,10%-,10%,+5%,+10%,100%} --quiet"; "{_, shift +, super +}XF86MonBrightness{Down,Up}" = "${getExe pkgs.brightnessctl} set {5%-,10%-,10%,+5%,+10%,100%} --quiet";
"super + x; {1, 2, 3, 4}" = "st {notes, newsboat, nmtui, bluetuith}"; "super + BackSpace" = "/home/opdavies/sysact";
"super + shift + b" = "/etc/profiles/per-user/opdavies/bin/bookmarkthis"; "super + shift + b" = "/etc/profiles/per-user/opdavies/bin/bookmarkthis";
"super + shift + i" = "${pkgs.xdotool}/bin/xdotool type $(cat ~/.local/share/snippets.txt | grep -v '^#' | grep -v '^$' | sort | dmenu -i -l 50 | cut -d' ' -f1)"; "super + shift + i" = "${pkgs.xdotool}/bin/xdotool type $(cat ~/.local/share/snippets.txt | grep -v '^#' | grep -v '^$' | sort | dmenu -i -l 50 | cut -d' ' -f1)";
"super + shift + p" = "${getExe pkgs.passmenu-otp} -i"; "super + shift + p" = "${getExe pkgs.passmenu-otp} -i";
"super + x; {1, 2, 3, 4}" = "st {notes, newsboat, nmtui, bluetuith}";
"@F3" = "${getExe pkgs.displayselect}"; "@F3" = "${getExe pkgs.displayselect}";
"@F9" = "/home/opdavies/.local/bin/mounter"; "@F9" = "/home/opdavies/.local/bin/mounter";
"@F10" = "/home/opdavies/.local/bin/unmounter"; "@F10" = "/home/opdavies/.local/bin/unmounter";

View file

@ -58,6 +58,7 @@ in
xdg.configFile."tmux-sessionizer/tmux-sessionizer.conf".text = '' xdg.configFile."tmux-sessionizer/tmux-sessionizer.conf".text = ''
TS_SEARCH_PATHS=(${builtins.concatStringsSep " " cfg.searchPaths}) TS_SEARCH_PATHS=(${builtins.concatStringsSep " " cfg.searchPaths})
TS_SESSION_COMMANDS=(nvim .)
''; '';
}; };
} }