organise all options into modules

This commit is contained in:
atagen 2024-05-08 15:05:43 +10:00
parent c7c6606d14
commit 3192b6ca09
43 changed files with 518 additions and 423 deletions

View file

@ -10,5 +10,8 @@
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
in {
inherit imports;
nix.settings.substituters = ["https://cache.nixos.org/"];
nix.settings = {
substituters = ["https://cache.nixos.org" " https://cache.nixos.org/" "https://cosmic.cachix.org/" "https://nix-community.cachix.org" " https://helix.cachix.org" "https://cosmic.cachix.org"];
trusted-public-keys = ["cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="];
};
}

View file

@ -8,6 +8,7 @@
nix-std,
...
}: {
# these settings propagate to home-manager's nixpkgs
nixpkgs = {
overlays = [
inputs.nur.overlay
@ -31,8 +32,6 @@
trusted-users = ["bolt" "plank"];
experimental-features = "nix-command flakes";
substitute = true;
substituters = ["https://cosmic.cachix.org/"];
trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="];
};
extraOptions = ''
keep-outputs = true
@ -40,51 +39,40 @@
'';
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
dates = "daily";
options = "--delete-older-than 3d";
};
};
imports = [];
imports = [
./modules/network.nix
./modules/term.nix
./modules/cosmic.nix
./modules/systemdboot.nix
./modules/sound.nix
./modules/sydney.nix
./modules/docs.nix
./modules/nix-meta.nix
];
systemd.services.NetworkManager-wait-online.enable = true; # for some reason nm doesn't enable without this
environment.pathsToLink = ["/share/zsh"];
# hm should have sorted this out
# qt = {
# enable = true;
# style = "adwaita-dark";
# };
hardware.enableRedistributableFirmware = true;
hardware.enableAllFirmware = true;
boot.loader.systemd-boot.consoleMode = "max";
boot.loader.timeout = 3;
boot.loader.systemd-boot.enable = true;
boot.tmp.useTmpfs = true;
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
time.timeZone = "Australia/Sydney";
# fix windows to use utc instead
time.hardwareClockInLocalTime = false;
# Select internationalisation properties.
i18n.defaultLocale = "en_AU.UTF-8";
i18n.supportedLocales = ["en_AU.UTF-8/UTF-8"];
console = {
font = "Lat2-Terminus16";
useXkbConfig = true; # use xkbOptions in tty.
};
services.libinput.enable = true;
hardware.opengl.enable = true;
hardware.opengl.driSupport32Bit = true;
#input stuff
services.libinput.enable = true;
services.desktopManager.cosmic.enable = true;
services.displayManager.cosmic-greeter.enable = true;
services.udisks2.enable = true;
services.system76-scheduler.enable = true;
services.flatpak.enable = true;
security.polkit.enable = true;
@ -92,73 +80,29 @@
xdg.autostart.enable = true;
xdg.portal.enable = true;
services.resolved = {
enable = true;
fallbackDns = ["103.1.206.179" "168.138.8.38" "168.138.12.137"];
dnssec = "false";
};
# Enable sound.
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
programs.dconf.enable = true;
services.colord.enable = true;
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
# services.tailscale.enable = true;
environment.systemPackages = with pkgs; [
man-pages
man-pages-posix
nixd
home-manager
cachix
curl
eza
swaybg
git
cachix
alejandra
];
services.atuin.enable = true;
documentation.dev.enable = true;
documentation.man.enable = true;
documentation.enable = true;
programs.nix-index-database.comma.enable = true;
programs.nix-index.enableZshIntegration = false;
programs.nix-index.enableBashIntegration = false;
# gnome/freedesktop compat stuff
programs.dconf.enable = true;
services.gvfs.enable = true;
services.mullvad-vpn.enable = true;
programs.nix-ld = {
enable = true;
package = pkgs.nix-ld-rs;
};
networking.firewall = {
checkReversePath = "loose";
};
# give cpuset to user
systemd.services."user@".serviceConfig.Delegate = "memory pids cpu cpuset";

View file

@ -0,0 +1,5 @@
{...}: {
services.desktopManager.cosmic.enable = true;
services.displayManager.cosmic-greeter.enable = true;
services.system76-scheduler.enable = true;
}

10
system/modules/docs.nix Normal file
View file

@ -0,0 +1,10 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
man-pages
man-pages-posix
];
documentation.dev.enable = true;
documentation.man.enable = true;
documentation.enable = true;
}

View file

@ -0,0 +1,13 @@
{...}: {
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
systemd.services.NetworkManager-wait-online.enable = true; # for some reason nm doesn't enable without this
services.resolved = {
enable = true;
fallbackDns = ["103.1.206.179" "168.138.8.38" "168.138.12.137"];
dnssec = "false";
};
services.mullvad-vpn.enable = true;
networking.firewall = {
checkReversePath = "loose";
};
}

View file

@ -0,0 +1,8 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
nixd
home-manager
cachix
alejandra
];
}

9
system/modules/sound.nix Normal file
View file

@ -0,0 +1,9 @@
{...}: {
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
}

View file

@ -0,0 +1,6 @@
{...}: {
time.timeZone = "Australia/Sydney";
time.hardwareClockInLocalTime = false;
i18n.defaultLocale = "en_AU.UTF-8";
i18n.supportedLocales = ["en_AU.UTF-8/UTF-8"];
}

View file

@ -0,0 +1,5 @@
{...}: {
boot.loader.systemd-boot.consoleMode = "max";
boot.loader.timeout = 3;
boot.loader.systemd-boot.enable = true;
}

8
system/modules/term.nix Normal file
View file

@ -0,0 +1,8 @@
{pkgs, ...}: {
environment.pathsToLink = ["/share/zsh"];
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
console = {
font = "Lat2-Terminus16";
};
}

View file

@ -1,18 +1,18 @@
{
inputs,
outputs,
config,
lib,
pkgs,
overlays,
modulesPath,
...
}: {
imports = [
./configuration.nix
# ../ollama.nix
];
users.users.bolt = {
isNormalUser = true;
extraGroups = ["wheel" "podman" "docker"]; # Enable sudo for the user.
};
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usbcore" "sd_mod"];
boot.initrd.kernelModules = [];
boot.initrd.systemd.enable = true;
@ -118,10 +118,6 @@
];
networking.hostName = "quiver"; # Define your hostname.
users.users.bolt = {
isNormalUser = true;
extraGroups = ["wheel" "podman" "docker"]; # Enable sudo for the user.
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/b993b463-c131-4ef1-9aba-0e3eadaa2f9a";