Flake: cleanup

This commit is contained in:
Filippo Berto 2023-04-08 15:14:48 +02:00
parent 016bf7c189
commit a4fa0c206a
No known key found for this signature in database
GPG key ID: FE98AE5EC52B1056
7 changed files with 47 additions and 155 deletions

26
flake.lock generated
View file

@ -456,31 +456,7 @@
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nixpkgs-u": "nixpkgs-u", "nixpkgs-u": "nixpkgs-u",
"pre-commit-hooks": "pre-commit-hooks_2", "pre-commit-hooks": "pre-commit-hooks_2"
"tex2nix": "tex2nix"
}
},
"tex2nix": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1675719328,
"narHash": "sha256-emjsJLIC3ediFxJhPyW7A9KFXMETCyCdDMWPb2OF/kA=",
"owner": "Mic92",
"repo": "tex2nix",
"rev": "7044a5c0934f3afc6050c697a32526bd5a05af5d",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "tex2nix",
"type": "github"
} }
}, },
"utils": { "utils": {

165
flake.nix
View file

@ -4,59 +4,18 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11"; nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
nixpkgs-u.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-u.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = { home-manager = { url = "github:nix-community/home-manager/release-22.11"; inputs = { nixpkgs.follows = "nixpkgs"; utils.follows = "flake-utils"; }; };
url = "github:nix-community/home-manager/release-22.11";
inputs = {
nixpkgs.follows = "nixpkgs";
utils.follows = "flake-utils";
};
};
agenix = { agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; };
url = "github:ryantm/agenix"; deploy-rs = { url = "github:serokell/deploy-rs"; inputs = { nixpkgs.follows = "nixpkgs"; }; };
inputs.nixpkgs.follows = "nixpkgs";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
nixos-hardware.url = "github:NixOS/nixos-hardware";
nix-rice = { url = "github:bertof/nix-rice/v0.3.1"; }; nix-rice = { url = "github:bertof/nix-rice/v0.3.1"; };
pre-commit-hooks = { nixos-generators = { url = "github:nix-community/nixos-generators"; inputs = { nixpkgs.follows = "nixpkgs"; }; };
url = "github:cachix/pre-commit-hooks.nix"; nixos-hardware.url = "github:NixOS/nixos-hardware";
inputs = { pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.follows = "flake-utils"; }; };
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
tex2nix = {
url = "github:Mic92/tex2nix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
}; };
outputs = outputs = { self, nixpkgs, nixpkgs-u, home-manager, agenix, deploy-rs, flake-utils, nixos-generators, nixos-hardware, nix-rice, pre-commit-hooks }:
{ self
, nixpkgs
, nixpkgs-u
, home-manager
, agenix
, deploy-rs
, flake-utils
, nixos-generators
, nixos-hardware
, nix-rice
, pre-commit-hooks
, tex2nix
}:
let let
config = { config = {
allowUnfree = true; allowUnfree = true;
@ -69,15 +28,8 @@
overlays = [ overlays = [
# Combine stable and unstable packages # Combine stable and unstable packages
(self: _: { (self: _: {
stable_pkgs = import nixpkgs { stable_pkgs = import nixpkgs { inherit config overlays; inherit (self) system; };
inherit config overlays; unstable_pkgs = import nixpkgs-u { inherit config overlays; inherit (self) system; };
inherit (self) system;
};
unstable_pkgs = import nixpkgs-u {
inherit config overlays;
inherit (self) system;
};
inherit (tex2nix.packages.${self.system}) tex2nix;
}) })
# Nix rice # Nix rice
@ -87,21 +39,11 @@
# Flakes packages # Flakes packages
(self: _: { (self: _: {
clipedit = self.callPackage ./custom/clipedit { }; clipedit = self.callPackage ./custom/clipedit { };
update-background = self.callPackage ./custom/update-background { update-background = self.callPackage ./custom/update-background { backgrounds_directory = "$HOME/Immagini/Sfondi/1080+/1440+"; };
backgrounds_directory = "$HOME/Immagini/Sfondi/1080+/1440+"; lockscreen = self.callPackage ./custom/lockscreen { palette = self.rice.colorPalette; font = self.rice.font.normal; };
}; sddm-theme-clairvoyance = self.callPackage ./custom/sddm-theme-clairvoyance { wallpaper = ./wallpapers/background.jpg; };
lockscreen = self.callPackage ./custom/lockscreen {
palette = self.rice.colorPalette;
font = self.rice.font.normal;
};
sddm-theme-clairvoyance =
self.callPackage ./custom/sddm-theme-clairvoyance {
wallpaper = ./wallpapers/background.jpg;
};
sddm-sugar-dark = self.callPackage ./custom/sddm-sugar-dark { }; sddm-sugar-dark = self.callPackage ./custom/sddm-sugar-dark { };
google-chrome = self.google-chrome.override { google-chrome = self.google-chrome.override { commandLineArgs = [ "--password-store=gnome" "--force-dark-mode" ]; };
commandLineArgs = [ "--password-store=gnome" "--force-dark-mode" ];
};
}) })
]; ];
@ -109,8 +51,6 @@
eachDefaultSystem (system: eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system config overlays; }; let pkgs = import nixpkgs { inherit system config overlays; };
in { in {
formatter = pkgs.nixpkgs-fmt;
checks = { checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run { pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.; src = ./.;
@ -129,32 +69,24 @@
''; '';
LOCAL_KEY = "/etc/nix/key"; LOCAL_KEY = "/etc/nix/key";
}; };
formatter = pkgs.nixpkgs-fmt;
}); });
nix_configuration = {
nixpkgs = { inherit overlays config; };
nix = {
inherit (config) extraOptions;
registry = {
stable = { from = { id = "stable"; type = "indirect"; }; flake = nixpkgs; };
unstable = { from = { id = "unstable"; type = "indirect"; }; flake = nixpkgs-u; };
};
};
};
commonModules = [ commonModules = [
# Nix configuration # Nix configuration
{ nix_configuration
nixpkgs = { inherit overlays config; };
nix = {
extraOptions = "experimental-features = nix-command flakes";
registry = {
stable = {
from = {
id = "stable";
type = "indirect";
};
flake = nixpkgs;
};
unstable = {
from = {
id = "unstable";
type = "indirect";
};
flake = nixpkgs-u;
};
};
};
}
# Home manager configuration # Home manager configuration
home-manager.nixosModules.default home-manager.nixosModules.default
@ -164,26 +96,23 @@
useUserPackages = true; useUserPackages = true;
}; };
} }
# Agenix configuration
agenix.nixosModules.default agenix.nixosModules.default
{ {
# age.secrets.oauth_proxy_client_credentials.file = ./secrets/oauth_proxy_client_credentials.age; # age.secrets.oauth_proxy_client_credentials.file = ./secrets/oauth_proxy_client_credentials.age;
age.secrets.spotify_password = { age.secrets.spotify_password = { file = ./secrets/spotify_password.age; owner = "bertof"; };
file = ./secrets/spotify_password.age;
owner = "bertof";
};
} }
./nixos_modules/bertof_user.nix ./nixos_modules/bertof_user.nix
# Some defaults # Some defaults
{ ./nixos_modules/fwupd.nix
services.fstrim.enable = true; ./nixos_modules/fstrim.nix
services.fwupd.enable = true; ./nixos_modules/btrfs-scrub.nix
}
./nixos_modules/btrfs_scrub.nix
./nixos_modules/distributed.nix ./nixos_modules/distributed.nix
./nixos_modules/remote-deploy.nix ./nixos_modules/remote-deploy.nix
./nixos_modules/extended_registry.nix ./nixos_modules/extended-registry.nix
./nixos_modules/automatic-garbage-collection.nix ./nixos_modules/automatic-garbage-collection.nix
./nixos_modules/automatic-upgrade.nix ./nixos_modules/automatic-upgrade.nix
./nixos_modules/zerotier.nix ./nixos_modules/zerotier.nix
@ -191,33 +120,13 @@
installerModules = [ installerModules = [
# Nix configuration # Nix configuration
{ nix_configuration
nixpkgs = { inherit overlays config; };
nix = {
extraOptions = "experimental-features = nix-command flakes";
registry = {
stable = {
from = {
id = "stable";
type = "indirect";
};
flake = nixpkgs;
};
unstable = {
from = {
id = "unstable";
type = "indirect";
};
flake = nixpkgs-u;
};
};
};
}
./nixos_modules/bertof_user.nix ./nixos_modules/bertof_user.nix
./nixos_modules/distributed.nix ./nixos_modules/distributed.nix
./nixos_modules/remote-deploy.nix ./nixos_modules/remote-deploy.nix
./nixos_modules/extended_registry.nix ./nixos_modules/extended-registry.nix
./nixos_modules/zerotier.nix ./nixos_modules/zerotier.nix
./nixos_modules/installer.nix ./nixos_modules/installer.nix
]; ];

3
nixos_modules/fstrim.nix Normal file
View file

@ -0,0 +1,3 @@
{
services.fstrim.enable = true;
}

3
nixos_modules/fwupd.nix Normal file
View file

@ -0,0 +1,3 @@
{
services.fwupd.enable = true;
}

View file

@ -2,9 +2,10 @@
services.openssh = { services.openssh = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
kbdInteractiveAuthentication = lib.mkDefault false;
permitRootLogin = lib.mkDefault "prohibit-password"; permitRootLogin = lib.mkDefault "prohibit-password";
passwordAuthentication = false; passwordAuthentication = lib.mkDefault false;
kbdInteractiveAuthentication = false;
}; };
users.users.root.openssh.authorizedKeys.keys = [ users.users.root.openssh.authorizedKeys.keys = [