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": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1751413152,
@ -263,6 +260,21 @@
"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": {
"locked": {
"lastModified": 1751274312,
@ -297,7 +309,9 @@
},
"nixvim": {
"inputs": {
"flake-parts": "flake-parts",
"flake-parts": [
"flake-parts"
],
"nixpkgs": [
"nixpkgs"
],
@ -366,6 +380,7 @@
"inputs": {
"agenix": "agenix",
"disko": "disko",
"flake-parts": "flake-parts",
"home-manager": "home-manager_2",
"nixos-hardware": "nixos-hardware",
"nixos-wsl": "nixos-wsl",

191
flake.nix
View file

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

View file

@ -19,10 +19,11 @@ in
keybindings = {
"{_, 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 + 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 + x; {1, 2, 3, 4}" = "st {notes, newsboat, nmtui, bluetuith}";
"@F3" = "${getExe pkgs.displayselect}";
"@F9" = "/home/opdavies/.local/bin/mounter";
"@F10" = "/home/opdavies/.local/bin/unmounter";

View file

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