Compare commits

...

3 commits

Author SHA1 Message Date
Natsu Kagami a3d59d71ec
Add bitwarden prompt 2024-07-11 16:40:40 +02:00
Natsu Kagami 58b72cbb8c
Use Lix 2024-07-11 16:35:11 +02:00
Natsu Kagami c488e5e05d
Simplify flake configuration 2024-07-11 16:26:10 +02:00
3 changed files with 162 additions and 79 deletions

View file

@ -480,6 +480,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_10": {
"inputs": {
"systems": "systems_9"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -589,21 +607,6 @@
} }
}, },
"flake-utils_8": { "flake-utils_8": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_9": {
"inputs": { "inputs": {
"systems": "systems_8" "systems": "systems_8"
}, },
@ -621,6 +624,36 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_9": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flakey-profile": {
"locked": {
"lastModified": 1712898590,
"narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=",
"owner": "lf-",
"repo": "flakey-profile",
"rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d",
"type": "github"
},
"original": {
"owner": "lf-",
"repo": "flakey-profile",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -817,9 +850,44 @@
"type": "github" "type": "github"
} }
}, },
"mpd-mpris": { "lix": {
"flake": false,
"locked": {
"lastModified": 1720626042,
"narHash": "sha256-f8k+BezKdJfmE+k7zgBJiohtS3VkkriycdXYsKOm3sc=",
"rev": "2a4376be20d70feaa2b0e640c5041fb66ddc67ed",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2a4376be20d70feaa2b0e640c5041fb66ddc67ed.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://git.lix.systems/lix-project/lix/archive/2.90.0.tar.gz"
}
},
"lix-module": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_7", "flake-utils": "flake-utils_7",
"flakey-profile": "flakey-profile",
"lix": "lix",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1720641669,
"narHash": "sha256-yEO2cGNgzm9x/XxiDQI+WckSWnZX63R8aJLBRSXtYNE=",
"rev": "5c48c833c15bb80d127a398a8c2484d42fdd8257",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/5c48c833c15bb80d127a398a8c2484d42fdd8257.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz"
}
},
"mpd-mpris": {
"inputs": {
"flake-utils": "flake-utils_8",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
@ -1229,6 +1297,7 @@
"kak-lsp": "kak-lsp", "kak-lsp": "kak-lsp",
"kakoune": "kakoune", "kakoune": "kakoune",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"lix-module": "lix-module",
"mpd-mpris": "mpd-mpris", "mpd-mpris": "mpd-mpris",
"nix-gaming": "nix-gaming", "nix-gaming": "nix-gaming",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
@ -1345,7 +1414,7 @@
}, },
"secrets": { "secrets": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_8" "flake-utils": "flake-utils_9"
}, },
"locked": { "locked": {
"lastModified": 1693981285, "lastModified": 1693981285,
@ -1525,6 +1594,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_9": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": { "utils": {
"inputs": { "inputs": {
"systems": "systems_3" "systems": "systems_3"
@ -1546,7 +1630,7 @@
"youmubot": { "youmubot": {
"inputs": { "inputs": {
"crane": "crane_5", "crane": "crane_5",
"flake-utils": "flake-utils_9", "flake-utils": "flake-utils_10",
"nixpkgs": "nixpkgs_11" "nixpkgs": "nixpkgs_11"
}, },
"locked": { "locked": {

114
flake.nix
View file

@ -27,6 +27,10 @@
flake-utils.url = github:numtide/flake-utils; flake-utils.url = github:numtide/flake-utils;
crane.url = github:ipetkov/crane; crane.url = github:ipetkov/crane;
arion.url = github:hercules-ci/arion; arion.url = github:hercules-ci/arion;
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
# --- # ---
# Imported apps # Imported apps
@ -61,8 +65,6 @@
overlays = import ./overlay.nix inputs; overlays = import ./overlay.nix inputs;
lib = nixpkgs.lib; lib = nixpkgs.lib;
hmOf = nixpkgs: if nixpkgs == inputs.nixpkgs then home-manager else inputs.home-manager-unstable;
applyOverlays = { ... }: { applyOverlays = { ... }: {
nixpkgs.overlays = lib.mkBefore overlays; nixpkgs.overlays = lib.mkBefore overlays;
}; };
@ -91,6 +93,7 @@
(nixpkgsAsRegistry_ stable) (nixpkgsAsRegistry_ stable)
./common.nix ./common.nix
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
inputs.lix-module.nixosModules.default
]; ];
}; };
common-nixos = stable: { ... }: { common-nixos = stable: { ... }: {
@ -103,6 +106,35 @@
]; ];
}; };
mkPersonalSystem = nixpkgs-module: system: { configuration
, homeManagerUsers ? { }
, extraModules ? [ ]
, includeCommonModules ? true
,
}:
let
home-manager-module =
if nixpkgs-module == inputs.nixpkgs then inputs.home-manager
else if nixpkgs-module == inputs.nixpkgs-unstable then inputs.home-manager-unstable
else builtins.abort "Unknown nixpkgs module, use `nixpkgs` or `nixpkgs-unstable`";
in
nixpkgs-module.lib.nixosSystem {
inherit system;
modules =
(if includeCommonModules then [
(common-nixos nixpkgs-module)
] else [ ]) ++ [
configuration
# Home Manager
home-manager-module.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users = homeManagerUsers;
}
] ++ extraModules;
};
in in
{ {
overlays.default = lib.composeManyExtensions overlays; overlays.default = lib.composeManyExtensions overlays;
@ -126,29 +158,16 @@
}; };
# Home configuration # Home configuration
nixosConfigurations."kagamiPC" = nixpkgs.lib.nixosSystem rec { nixosConfigurations."kagamiPC" = mkPersonalSystem nixpkgs-unstable "x86_64-linux" {
system = "x86_64-linux"; configuration = ./nki-home/configuration.nix;
modules = [ homeManagerUsers.nki = import ./home/kagami-pc-home.nix;
(common-nixos nixpkgs) extraModules = [ osuStable ];
./nki-home/configuration.nix
osuStable
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nki = { ... }: {
imports = [
./home/kagami-pc-home.nix
];
};
}
];
}; };
# yoga g8 configuration # yoga g8 configuration
nixosConfigurations."nki-yoga-g8" = nixpkgs.lib.nixosSystem rec { nixosConfigurations."nki-yoga-g8" = mkPersonalSystem nixpkgs "x86_64-linux" {
system = "x86_64-linux"; configuration = ./nki-yoga-g8/configuration.nix;
modules = [ homeManagerUsers.nki = import ./home/nki-x1c1.nix;
(common-nixos nixpkgs) extraModules = [
inputs.lanzaboote.nixosModules.lanzaboote inputs.lanzaboote.nixosModules.lanzaboote
({ ... }: { ({ ... }: {
# Sets up secure boot # Sets up secure boot
@ -158,20 +177,13 @@
pkiBundle = "/etc/secureboot"; pkiBundle = "/etc/secureboot";
}; };
}) })
./nki-yoga-g8/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nki = import ./home/nki-x1c1.nix;
}
]; ];
}; };
# framework configuration # framework configuration
nixosConfigurations."nki-framework" = nixpkgs-unstable.lib.nixosSystem rec { nixosConfigurations."nki-framework" = mkPersonalSystem nixpkgs-unstable "x86_64-linux" {
system = "x86_64-linux"; configuration = ./nki-framework/configuration.nix;
modules = [ homeManagerUsers.nki = import ./home/nki-framework.nix;
(common-nixos nixpkgs-unstable) extraModules = [
inputs.lanzaboote.nixosModules.lanzaboote inputs.lanzaboote.nixosModules.lanzaboote
inputs.nixos-hardware.nixosModules.framework-13-7040-amd inputs.nixos-hardware.nixosModules.framework-13-7040-amd
({ ... }: { ({ ... }: {
@ -182,41 +194,21 @@
pkiBundle = "/etc/secureboot"; pkiBundle = "/etc/secureboot";
}; };
}) })
./nki-framework/configuration.nix
(hmOf nixpkgs-unstable).nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.users.nki = import ./home/nki-framework.nix;
}
]; ];
}; };
# macbook nixos # macbook nixos
nixosConfigurations."kagami-air-m1" = inputs.nixpkgs.lib.nixosSystem rec { nixosConfigurations."kagami-air-m1" = mkPersonalSystem nixpkgs "aarch64-linux" {
system = "aarch64-linux"; configuration = ./kagami-air-m1/configuration.nix;
modules = [ homeManagerUsers.nki = import ./home/macbook-nixos.nix;
(common-nixos inputs.nixpkgs) extraModules = [ inputs.nixos-m1.nixosModules.apple-silicon-support ];
inputs.nixos-m1.nixosModules.apple-silicon-support
./kagami-air-m1/configuration.nix
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nki = import ./home/macbook-nixos.nix;
}
];
}; };
# DigitalOcean node # DigitalOcean node
nixosConfigurations."nki-personal-do" = nixpkgs.lib.nixosSystem rec { nixosConfigurations."nki-personal-do" = mkPersonalSystem nixpkgs "x86_64-linux" {
system = "x86_64-linux"; configuration = ./nki-personal-do/configuration.nix;
modules = [ modules = [
(common-nixos nixpkgs)
inputs.arion.nixosModules.arion inputs.arion.nixosModules.arion
./modules/my-tinc
inputs.youmubot.nixosModules.default inputs.youmubot.nixosModules.default
./nki-personal-do/configuration.nix
inputs.secrets.nixosModules.nki-personal-do inputs.secrets.nixosModules.nki-personal-do
]; ];
}; };
@ -231,8 +223,8 @@
# This is highly advised, and will prevent many possible mistakes # This is highly advised, and will prevent many possible mistakes
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
} // (inputs.flake-utils.lib.eachDefaultSystem (system: { } // (inputs.flake-utils.lib.eachDefaultSystem (system: {
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt; formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
})); }));
} }

View file

@ -45,6 +45,12 @@ let
${pkgs.grim}/bin/grim -g (${pkgs.slurp}/bin/slurp) - | ${pkgs.swappy}/bin/swappy -f - ${pkgs.grim}/bin/grim -g (${pkgs.slurp}/bin/slurp) - | ${pkgs.swappy}/bin/swappy -f -
''; '';
rofi-rbw-script = pkgs.writeShellApplication {
name = "rofi-rbw-script";
runtimeInputs = with pkgs; [ rofi wtype rofi-rbw ];
text = "rofi-rbw";
};
ignored-devices = [ "Surface_Headphones" ]; ignored-devices = [ "Surface_Headphones" ];
playerctl = "${pkgs.playerctl}/bin/playerctl --ignore-player=${strings.concatStringsSep "," ignored-devices}"; playerctl = "${pkgs.playerctl}/bin/playerctl --ignore-player=${strings.concatStringsSep "," ignored-devices}";
@ -214,6 +220,7 @@ in
# Launcher # Launcher
"${mod}+space" = "exec rofi -show drun"; "${mod}+space" = "exec rofi -show drun";
"${mod}+tab" = "exec ${./rofi-window.py}"; "${mod}+tab" = "exec ${./rofi-window.py}";
"${mod}+shift+p" = "exec ${lib.getExe rofi-rbw-script}";
} // { } // {
## Splits ## Splits
"${mod}+v" = "split v"; "${mod}+v" = "split v";