Compare commits

..

6 Commits

6 changed files with 34 additions and 17 deletions

View File

@ -23,19 +23,6 @@
networking.hostName = "MaxNixosLaptop"; # Define your hostname.
# NIXOS
nix.settings = {
experimental-features = ["nix-command" "flakes"];
substituters = ["https://cache.nixos.org" "https://nix-community.cachix.org"];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
auto-optimise-store = true;
max-jobs = "auto";
cores = 12;
};
# Define a user account. Don't forget to set a password with passwd.
users.users.max = {
isNormalUser = true;

20
modules/nixos/cache.nix Normal file
View File

@ -0,0 +1,20 @@
{
lib,
config,
...
}: let
cfg = config.myConfig.cache;
in {
options.myConfig.cache = {
enable = lib.mkEnableOption "extra binary caches";
};
config = lib.mkIf cfg.enable {
nix.settings = {
substituters = ["https://nix-community.cachix.org"];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
}

View File

@ -10,7 +10,7 @@ in {
enable = lib.mkEnableOption "printing";
};
config = {
config = lib.mkIf cfg.enable {
# Enable CUPS to print documents.
services.printing = {
enable = true;

View File

@ -5,7 +5,7 @@
}: let
cfg = config.myConfig;
in {
imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix ./touch.nix];
imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix ./touch.nix ./cache.nix ./nix.nix];
options.myConfig = {
enable = lib.mkEnableOption "my custom config";
@ -17,6 +17,7 @@ in {
bootloader.enable = true;
locale.enable = true;
rebuild.enable = true;
cache.enable = true;
greetd.enable = lib.mkIf cfg.desktop true;
sway.enable = lib.mkIf cfg.desktop true;

10
modules/nixos/nix.nix Normal file
View File

@ -0,0 +1,10 @@
{...}: {
config = {
nix.settings = {
experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true;
max-jobs = "auto";
cores = 1;
};
};
}

View File

@ -21,14 +21,13 @@
${pkgs.alejandra}/bin/alejandra . #&>/dev/null
# Shows your changes
${pkgs.git}/bin/git diff -U0 *.nix
${pkgs.git}/bin/git diff -U0
echo "NixOS Rebuilding..."
# echo using sudo so we get feedback after unlocking
sudo echo "Beginning rebuild"
# Rebuild, output simplified errors, log trackebacks
# sudo nixos-rebuild switch &>nixos-switch.log || (${pkgs.coreutils}/bin/cat nixos-switch.log | ${pkgs.gnugrep}/bin/grep --color error && false)
sudo nixos-rebuild switch
# Get current generation metadata