diff --git a/configurations/adb.nix b/configurations/adb.nix new file mode 100644 index 00000000..d7a8462f --- /dev/null +++ b/configurations/adb.nix @@ -0,0 +1,6 @@ +{ ... }: + +{ + programs.adb.enable = true; + users.users.charlotte.extraGroups = [ "adbusers" ]; +} diff --git a/configurations/base-x/default.nix b/configurations/base-x.nix similarity index 100% rename from configurations/base-x/default.nix rename to configurations/base-x.nix diff --git a/configurations/direnv/default.nix b/configurations/direnv.nix similarity index 66% rename from configurations/direnv/default.nix rename to configurations/direnv.nix index f13f698e..9d2b361b 100644 --- a/configurations/direnv/default.nix +++ b/configurations/direnv.nix @@ -1,6 +1,11 @@ { ... }: { + custom.zfs.homeLinks = [ + { path = ".local/share/direnv"; type = "cache"; } + { path = ".cache/lorri"; type = "cache"; } + ]; + home-manager.users.charlotte = { ... }: { programs.direnv = { enable = true; diff --git a/configurations/docker.nix b/configurations/docker.nix new file mode 100644 index 00000000..ab6fe058 --- /dev/null +++ b/configurations/docker.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + custom.zfs.systemLinks = [ + { path = "/var/lib/docker"; type = "cache"; } + { path = "/var/lib/docker/volumes"; type = "data"; } + ]; + virtualisation.docker.enable = true; + users.users.charlotte.extraGroups = [ + "docker" + ]; + +} diff --git a/configurations/dropbox/default.nix b/configurations/dropbox.nix similarity index 87% rename from configurations/dropbox/default.nix rename to configurations/dropbox.nix index 4bb7cebc..0905bbe4 100644 --- a/configurations/dropbox/default.nix +++ b/configurations/dropbox.nix @@ -1,6 +1,10 @@ { ... }: { + custom.zfs.homeLinks = [ + { path = ".dropbox"; type = "data"; } + { path = "Dropbox"; type = "data"; } + ]; home-manager.users.charlotte = { pkgs, ... }: { systemd.user.services = { dropbox = { diff --git a/configurations/eid.nix b/configurations/eid.nix new file mode 100644 index 00000000..5d1eb936 --- /dev/null +++ b/configurations/eid.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + services.pcscd = { + enable = true; + plugins = [ pkgs.ccid ]; + }; + + environment.systemPackages = with pkgs; [ eid-mw ]; +} diff --git a/configurations/firefox.nix b/configurations/firefox.nix new file mode 100644 index 00000000..5dc320e6 --- /dev/null +++ b/configurations/firefox.nix @@ -0,0 +1,10 @@ +{ ... }: { + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ firefox ]; + }; + + custom.zfs.homeLinks = [ + { path = ".cache/mozilla"; type = "cache"; } + { path = ".mozilla"; type = "data"; } + ]; +} diff --git a/configurations/fonts.nix b/configurations/fonts.nix new file mode 100644 index 00000000..ef356239 --- /dev/null +++ b/configurations/fonts.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: + +{ + fonts = { + enableFontDir = true; + fontconfig = { + enable = true; + defaultFonts = { + emoji = [ "Noto Color Emoji" ]; + monospace = [ "Fira Code" ]; + sansSerif = [ "Noto Sans" ]; + serif = [ "Noto Serif" ]; + }; + }; + fonts = with pkgs; [ + fira-code + fira-code-symbols + font-awesome_4 + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + noto-fonts-extra + ]; + }; +} diff --git a/configurations/git/default.nix b/configurations/git.nix similarity index 95% rename from configurations/git/default.nix rename to configurations/git.nix index 53102091..9cc4add1 100644 --- a/configurations/git/default.nix +++ b/configurations/git.nix @@ -19,7 +19,7 @@ enable = true; extraConfig = { branch = { - setupautorebase = "always"; + autosetuprebase = "always"; }; }; ignores = [ diff --git a/configurations/gnupg.nix b/configurations/gnupg.nix new file mode 100644 index 00000000..f933287c --- /dev/null +++ b/configurations/gnupg.nix @@ -0,0 +1,22 @@ +{ ... }: + +{ + custom.zfs.homeLinks = [ + { path = ".gnupg/crls.d"; type = "data"; } + { path = ".gnupg/private-keys-v1.d"; type = "data"; } + { path = ".gnupg/pubring.kbx"; type = "data"; } + { path = ".gnupg/trustdb.gpg"; type = "data"; } + ]; + programs.gnupg.agent.enable = true; + home-manager.users.charlotte = { pkgs, ... }: { + programs = { + gpg.enable = true; + }; + services.gpg-agent = { + enable = true; + defaultCacheTtl = 7200; + maxCacheTtl = 99999; + pinentryFlavor = "qt"; + }; + }; +} diff --git a/configurations/i3/default.nix b/configurations/i3.nix similarity index 85% rename from configurations/i3/default.nix rename to configurations/i3.nix index b01147bf..263ca546 100644 --- a/configurations/i3/default.nix +++ b/configurations/i3.nix @@ -1,11 +1,10 @@ -with import { }; -{ ... }: +{ pkgs, ... }: let - launcher = import ../sway/launcher.nix { inherit pkgs stdenv; }; - status-configuration = import ../sway/status-configuration.nix { inherit pkgs; }; + launcher = import ./sway/launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; }; + status-configuration = import ./sway/status-configuration.nix { inherit pkgs; }; in { - imports = [ ../base-x/default.nix ]; + imports = [ ./base-x.nix ]; home-manager.users.charlotte = { pkgs, ... }: { xsession = { windowManager.i3 = { diff --git a/configurations/joplin.nix b/configurations/joplin.nix new file mode 100644 index 00000000..f67ff849 --- /dev/null +++ b/configurations/joplin.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ joplin-desktop ]; + }; + + custom.zfs.homeLinks = [ + { path = ".config/joplin-desktop"; type = "data"; } + { path = ".config/Joplin"; type = "data"; } + ]; +} diff --git a/configurations/kernel.nix b/configurations/kernel.nix new file mode 100644 index 00000000..6f73d453 --- /dev/null +++ b/configurations/kernel.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: + +{ + # Use latest kernel + boot.kernelPackages = pkgs.linuxPackages_latest; +} diff --git a/configurations/kitty/default.nix b/configurations/kitty.nix similarity index 100% rename from configurations/kitty/default.nix rename to configurations/kitty.nix diff --git a/configurations/locale.nix b/configurations/locale.nix new file mode 100644 index 00000000..d0e3e0d8 --- /dev/null +++ b/configurations/locale.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + i18n = { + defaultLocale = "en_IE.UTF-8"; + extraLocaleSettings = { + LC_TIME = "en_GB.UTF-8"; + }; + }; + + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; +} diff --git a/configurations/mounts.nix b/configurations/mounts.nix new file mode 100644 index 00000000..45bee3ee --- /dev/null +++ b/configurations/mounts.nix @@ -0,0 +1,41 @@ +{ pkgs, ... }: + +{ + imports = [ ./mounts/secret.nix ]; + + environment.systemPackages = [ pkgs.keyutils ]; + # Remove this once https://github.com/NixOS/nixpkgs/issues/34638 is resolved + # The TL;DR is: the kernel calls out to the hard-coded path of + # /sbin/request-key as part of its CIFS auth process, which of course does + # not exist on NixOS due to the usage of Nix store paths. + system.activationScripts.symlink-requestkey = '' + if [ ! -d /sbin ]; then + mkdir /sbin + fi + ln -sfn /run/current-system/sw/bin/request-key /sbin/request-key + ''; + # request-key expects a configuration file under /etc + environment.etc."request-key.conf" = { + text = + let + upcall = "${pkgs.cifs-utils}/bin/cifs.upcall"; + keyctl = "${pkgs.keyutils}/bin/keyctl"; + in + '' + #OP TYPE DESCRIPTION CALLOUT_INFO PROGRAM + # -t is required for DFS share servers... + create cifs.spnego * * ${upcall} -t %k + create dns_resolver * * ${upcall} %k + # Everything below this point is essentially the default configuration, + # modified minimally to work under NixOS. Notably, it provides debug + # logging. + create user debug:* negate ${keyctl} negate %k 30 %S + create user debug:* rejected ${keyctl} reject %k 30 %c %S + create user debug:* expired ${keyctl} reject %k 30 %c %S + create user debug:* revoked ${keyctl} reject %k 30 %c %S + create user debug:loop:* * |${pkgs.coreutils}/bin/cat + create user debug:* * ${pkgs.keyutils}/share/keyutils/request-key-debug.sh %k %d %c %S + negate * * * ${keyctl} negate %k 30 %S + ''; + }; +} diff --git a/configurations/mounts/secret.nix b/configurations/mounts/secret.nix new file mode 100644 index 00000000..a8be168f Binary files /dev/null and b/configurations/mounts/secret.nix differ diff --git a/configurations/neovim/default.nix b/configurations/neovim.nix similarity index 91% rename from configurations/neovim/default.nix rename to configurations/neovim.nix index e32b2276..3b6892f5 100644 --- a/configurations/neovim/default.nix +++ b/configurations/neovim.nix @@ -20,11 +20,16 @@ let }; }; }; - jdtls = import ../../packages/jdtls/default.nix { inherit pkgs; stdenv = pkgs.stdenv; }; - kotlinls = import ../../packages/kotlin-language-server/default.nix { inherit pkgs; }; - nodePackages = import ../../packages/node/default.nix { inherit pkgs; }; + jdtls = import ../packages/jdtls/default.nix { inherit pkgs; stdenv = pkgs.stdenv; }; + kotlinls = import ../packages/kotlin-language-server/default.nix { inherit pkgs; }; + nodePackages = import ../packages/node/default.nix { inherit pkgs; }; in { + custom.zfs.homeLinks = [ + { path = ".local/share/nvim"; type = "cache"; } + { path = ".cache/nvim"; type = "cache"; } + ]; + home-manager.users.charlotte = { pkgs, ... }: { home.packages = [ ( @@ -42,11 +47,11 @@ in " Undo over sessions set undofile - set undodir=~/.cache/nvimundo + set undodir=~/.cache/nvim/undo " Automatically save sessions on exit and load them on start function! MakeSession() - let b:sessiondir = $HOME . "/.config/nvim/sessions" . getcwd() + let b:sessiondir = $HOME . "/.local/share/nvim/sessions" . getcwd() if (filewritable(b:sessiondir) != 2) exe 'silent !mkdir -p ' b:sessiondir redraw! @@ -56,7 +61,7 @@ in endfunction function! LoadSession() - let b:sessiondir = $HOME . "/.config/nvim/sessions" . getcwd() + let b:sessiondir = $HOME . "/.local/share/nvim/sessions" . getcwd() let b:sessionfile = b:sessiondir . "/session.vim" if (filereadable(b:sessionfile)) exe 'source ' b:sessionfile diff --git a/configurations/networkmanager.nix b/configurations/networkmanager.nix new file mode 100644 index 00000000..597097bf --- /dev/null +++ b/configurations/networkmanager.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: + +{ + custom.zfs.systemLinks = [ + { path = "/etc/NetworkManager/system-connections"; type = "data"; } + ]; + + networking = { + hosts = { "127.0.0.1" = [ "dodona.localhost" "sandbox.localhost" ]; }; + networkmanager = { + enable = true; + packages = [ pkgs.networkmanager-vpnc ]; + wifi.macAddress = "random"; + }; + }; + + users.users.charlotte.extraGroups = [ + "networkmanager" + ]; + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ + networkmanagerapplet + ]; + }; +} diff --git a/configurations/nix-index.nix b/configurations/nix-index.nix new file mode 100644 index 00000000..cf6e2da2 --- /dev/null +++ b/configurations/nix-index.nix @@ -0,0 +1,36 @@ +{ ... }: + +{ + custom.zfs.homeLinks = [ + { path = ".cache/nix-index"; type = "cache"; } + ]; + + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ + nix-index + ]; + systemd.user = { + services.nix-index = { + Unit = { + Description = "Service to run nix-index"; + }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.nix-index}/bin/nix-index"; + }; + }; + timers.nix-index = { + Unit = { + Description = "Timer that starts nix-index every two hours"; + PartOf = [ "nix-index.service" ]; + }; + Timer = { + OnCalendar = "00/2:30"; + }; + Install = { + WantedBy = [ "default.target" ]; + }; + }; + }; + }; +} diff --git a/configurations/nix-store.nix b/configurations/nix-store.nix new file mode 100644 index 00000000..56311c03 --- /dev/null +++ b/configurations/nix-store.nix @@ -0,0 +1,25 @@ +{ ... }: + +{ + nix = { + gc = { + automatic = true; + dates = "hourly"; + options = "--delete-older-than 7d"; + }; + optimise = { + automatic = true; + dates = [ "hourly" ]; + }; + }; + + system.autoUpgrade = { + allowReboot = false; + enable = true; + dates = "hourly"; + }; + + home-manager.users.charlotte = { ... }: { + nixpkgs.config.allowUnfree = true; + }; +} diff --git a/configurations/openbox/default.nix b/configurations/openbox.nix similarity index 69% rename from configurations/openbox/default.nix rename to configurations/openbox.nix index 6fd357cb..3e4fe54b 100644 --- a/configurations/openbox/default.nix +++ b/configurations/openbox.nix @@ -1,9 +1,9 @@ { ... }: { - imports = [ ../base-x/default.nix ]; + imports = [ ./base-x.nix ]; home-manager.users.charlotte = { pkgs, ... }: { - xdg.configFile."openbox/rc.xml".source = ./rc.xml; + xdg.configFile."openbox/rc.xml".source = ./openbox/rc.xml; xsession = { windowManager.command = "${pkgs.openbox}/bin/openbox"; initExtra = '' diff --git a/configurations/sound.nix b/configurations/sound.nix new file mode 100644 index 00000000..b8abffca --- /dev/null +++ b/configurations/sound.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + custom.zfs.systemLinks = [ + { path = "/var/lib/pulse"; type = "data"; } + ]; + + sound.enable = true; + hardware.pulseaudio = { + enable = true; + systemWide = true; + }; + + users.users.charlotte.extraGroups = [ "audio" ]; +} diff --git a/configurations/ssh/default.nix b/configurations/ssh.nix similarity index 64% rename from configurations/ssh/default.nix rename to configurations/ssh.nix index 2a5e03ac..7a20520f 100644 --- a/configurations/ssh/default.nix +++ b/configurations/ssh.nix @@ -1,7 +1,16 @@ { ... }: { - home-manager.users.charlotte = { ... }: { + imports = [ ./ssh/secret.nix ]; + + custom.zfs.homeLinks = [ + { path = ".ssh/known_hosts"; type = "cache"; } + ]; + + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ + ssh + ]; programs.ssh = { enable = true; compression = true; diff --git a/configurations/ssh/secret.nix b/configurations/ssh/secret.nix new file mode 100644 index 00000000..98e645a7 Binary files /dev/null and b/configurations/ssh/secret.nix differ diff --git a/configurations/sway/default.nix b/configurations/sway.nix similarity index 95% rename from configurations/sway/default.nix rename to configurations/sway.nix index 0d60837b..e4749b08 100644 --- a/configurations/sway/default.nix +++ b/configurations/sway.nix @@ -1,16 +1,12 @@ -with import { }; { pkgs, ... }: let - firefox = import ../../programs/firefox/default.nix { inherit pkgs; }; - launcher = import ./launcher.nix { inherit pkgs stdenv; }; - color-picker = import ./color-picker.nix { inherit pkgs; }; - screenshot = import ./screenshot.nix { inherit pkgs; }; - status-configuration = import ./status-configuration.nix { inherit pkgs; }; + launcher = import ./sway/launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; }; + color-picker = import ./sway/color-picker.nix { inherit pkgs; }; + screenshot = import ./sway/screenshot.nix { inherit pkgs; }; + status-configuration = import ./sway/status-configuration.nix { inherit pkgs; }; in { - imports = [ - ./kanshi.nix - ]; + imports = [ ./sway/kanshi.nix ]; programs = { sway = { enable = true; @@ -92,7 +88,7 @@ in ### Startup programs # workspace 1 - exec ${firefox}/bin/firefox + exec ${pkgs.firefox}/bin/firefox workspace 3 exec ${pkgs.thunderbird}/bin/thunderbird workspace 4 diff --git a/configurations/sway/launcher.nix b/configurations/sway/launcher.nix index 55c47917..0a8b2e77 100644 --- a/configurations/sway/launcher.nix +++ b/configurations/sway/launcher.nix @@ -1,6 +1,5 @@ { pkgs, stdenv }: let - pass = import ../../programs/pass/default.nix { inherit pkgs; }; gemoji = pkgs.buildRubyGem { pname = "gemoji"; gemName = "gemoji"; @@ -74,16 +73,16 @@ pkgs.writeScriptBin "launcher" '' echo $passfile case $option in username) - swaymsg exec -- "${pass}/bin/pass show '$passfile' | sed -n 's/^Username: *//p' | tr -d '\n' | ${pkgs.wl-clipboard}/bin/wl-copy --foreground" + swaymsg exec -- "${pkgs.pass}/bin/pass show '$passfile' | sed -n 's/^Username: *//p' | tr -d '\n' | ${pkgs.wl-clipboard}/bin/wl-copy --foreground" ;; password) - swaymsg exec -- "${pass}/bin/pass show -c0 '$passfile'" + swaymsg exec -- "${pkgs.pass}/bin/pass show -c0 '$passfile'" ;; otp) - swaymsg exec -- "${pass}/bin/pass otp -c '$passfile'" + swaymsg exec -- "${pkgs.pass}/bin/pass otp -c '$passfile'" ;; edit) - ${pass}/bin/pass edit "$passfile" + ${pkgs.pass}/bin/pass edit "$passfile" ;; esac } diff --git a/configurations/syncthing.nix b/configurations/syncthing.nix new file mode 100644 index 00000000..14332719 --- /dev/null +++ b/configurations/syncthing.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + custom.zfs.homeLinks = [ + { path = ".config/syncthing"; type = "data"; } + { path = "sync"; type = "data"; } + ]; + home-manager.users.charlotte = { pkgs, ... }: { + services.syncthing.enable = true; + }; +} diff --git a/configurations/syncthing/default.nix b/configurations/syncthing/default.nix deleted file mode 100644 index 39913fe0..00000000 --- a/configurations/syncthing/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - home-manager.users.charlotte = { pkgs, ... }: { - services.syncthing.enable = true; - }; -} diff --git a/configurations/teams.nix b/configurations/teams.nix new file mode 100644 index 00000000..adef0b8d --- /dev/null +++ b/configurations/teams.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ teams ]; + }; + + custom.zfs.homeLinks = [ + { path = ".config/Microsoft"; type = "data"; } + ]; +} diff --git a/configurations/themes.nix b/configurations/themes.nix new file mode 100644 index 00000000..0b4d372c --- /dev/null +++ b/configurations/themes.nix @@ -0,0 +1,47 @@ +{ ... }: + +{ + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = [ pkgs.vanilla-dmz ]; + home.file = { + ".icons/default/index.theme".text = '' + [Icon Theme] + Name=Default + Comment=Default Cursor Theme + Inherits=Vanilla-DMZ + ''; + }; + dconf.settings."org/gnome/desktop/interface" = { + gtk-theme = "Arc"; + icon-theme = "Arc"; + cursor-theme = "Vanilla-DMZ"; + }; + gtk = { + enable = true; + font = { + package = pkgs.noto-fonts; + name = "Noto Sans 10"; + }; + gtk2.extraConfig = '' + gtk-cursor-theme-name = "Vanilla-DMZ" + gtk-cursor-theme-size = 0 + ''; + gtk3.extraConfig = { + gtk-cursor-theme-name = "Vanilla-DMZ"; + gtk-cursor-theme-size = 0; + }; + iconTheme = { + package = pkgs.arc-icon-theme; + name = "Arc"; + }; + theme = { + package = pkgs.arc-theme; + name = "Arc"; + }; + }; + qt = { + enable = true; + platformTheme = "gtk"; + }; + }; +} diff --git a/configurations/thunderbird.nix b/configurations/thunderbird.nix new file mode 100644 index 00000000..9cc0a3f9 --- /dev/null +++ b/configurations/thunderbird.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ thunderbird ]; + }; + + custom.zfs.homeLinks = [ + { path = ".cache/thunderbird"; type = "cache"; } + { path = ".thunderbird"; type = "data"; } + ]; +} diff --git a/configurations/tmux/default.nix b/configurations/tmux.nix similarity index 84% rename from configurations/tmux/default.nix rename to configurations/tmux.nix index 3ed1fa9d..ac578905 100644 --- a/configurations/tmux/default.nix +++ b/configurations/tmux.nix @@ -17,8 +17,8 @@ tmuxinator.enable = true; }; xdg.configFile = { - "tmuxinator/accentor.yml".source = ./accentor.yml; - "tmuxinator/dodona.yml".source = ./dodona.yml; + "tmuxinator/accentor.yml".source = ./tmux/accentor.yml; + "tmuxinator/dodona.yml".source = ./tmux/dodona.yml; }; }; } diff --git a/configurations/users.nix b/configurations/users.nix new file mode 100644 index 00000000..a018b727 --- /dev/null +++ b/configurations/users.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: + +{ + imports = [ ./users/secret.nix ]; + + users = { + mutableUsers = false; + defaultUserShell = pkgs.zsh; + users = { + charlotte = { + isNormalUser = true; + home = "/home/charlotte"; + description = "Charlotte Van Petegem"; + extraGroups = [ + "input" + "systemd-journal" + "video" + "wheel" + ]; + }; + }; + }; +} diff --git a/configurations/users/secret.nix b/configurations/users/secret.nix new file mode 100644 index 00000000..1fb856d2 Binary files /dev/null and b/configurations/users/secret.nix differ diff --git a/configurations/xdg-dirs.nix b/configurations/xdg-dirs.nix new file mode 100644 index 00000000..e771fb23 --- /dev/null +++ b/configurations/xdg-dirs.nix @@ -0,0 +1,32 @@ +{ ... }: + +{ + custom.zfs.homeLinks = [ + { path = "desktop"; type = "data"; } + { path = "documents"; type = "data"; } + { path = "downloads"; type = "data"; } + { path = "music"; type = "data"; } + { path = "pictures"; type = "data"; } + { path = "repos"; type = "data"; } + { path = "templates"; type = "data"; } + { path = "videos"; type = "data"; } + ]; + + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ xdg-user-dirs ]; + xdg = { + enable = true; + userDirs = { + enable = true; + desktop = "\$HOME/desktop"; + documents = "\$HOME/documents"; + download = "\$HOME/downloads"; + music = "\$HOME/music"; + pictures = "\$HOME/pictures"; + publicShare = "\$HOME/desktop"; + templates = "\$HOME/templates"; + videos = "\$HOME/videos"; + }; + }; + }; +} diff --git a/configurations/zsh/default.nix b/configurations/zsh.nix similarity index 87% rename from configurations/zsh/default.nix rename to configurations/zsh.nix index d88d66f6..49711a4a 100644 --- a/configurations/zsh/default.nix +++ b/configurations/zsh.nix @@ -1,6 +1,10 @@ { ... }: { + custom.zfs.homeLinks = [ + { path = ".local/share/autojump"; type = "cache"; } + { path = ".local/share/zsh"; type = "cache"; } + ]; home-manager.users.charlotte = { pkgs, ... }: { home.packages = [ pkgs.autojump ]; programs.zsh = { @@ -10,7 +14,7 @@ dotDir = ".config/zsh"; history = { expireDuplicatesFirst = true; - path = "\$HOME/.config/zsh/zsh_history"; + path = "\$HOME/.local/share/zsh/history"; }; initExtra = '' source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh diff --git a/machines/pentos/default.nix b/machines/kholinar/default.nix similarity index 64% rename from machines/pentos/default.nix rename to machines/kholinar/default.nix index 35888599..60b051f1 100644 --- a/machines/pentos/default.nix +++ b/machines/kholinar/default.nix @@ -1,21 +1,28 @@ -{ config, pkgs, ... }: +{ pkgs, lib, ... }: { imports = [ ./hardware.nix ./secret.nix + ../../configurations/eid.nix ../../profiles/bluetooth/default.nix ../../profiles/common/default.nix ../../profiles/graphical/default.nix ]; - boot.loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; + # Use the systemd-boot EFI boot loader. + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; }; - networking.hostName = "pentos"; + networking = { + hostId = "3cc1a4b2"; + hostName = "kholinar"; + }; time.timeZone = "Europe/Brussels"; @@ -25,14 +32,18 @@ # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "20.03"; + system.stateVersion = "20.09"; home-manager.users.charlotte = { ... }: { - home.stateVersion = "20.03"; + home.stateVersion = "20.09"; }; - # Machine-specific application settings + # Machine-specific settings custom = { git.email = "charlotte@vanpetegem.me"; + zfs = { + enable = true; + encrypted = true; + }; }; } diff --git a/machines/kholinar/hardware.nix b/machines/kholinar/hardware.nix new file mode 100644 index 00000000..e7b8d24d --- /dev/null +++ b/machines/kholinar/hardware.nix @@ -0,0 +1,48 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ "i915" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "rpool/local/root"; + fsType = "zfs"; + }; + + fileSystems."/nix" = { + device = "rpool/local/nix"; + fsType = "zfs"; + }; + + fileSystems."/data" = { + device = "rpool/safe/data"; + fsType = "zfs"; + }; + + fileSystems."/cache" = { + device = "rpool/local/cache"; + fsType = "zfs"; + }; + + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/BEEE-D83A"; + fsType = "vfat"; + }; + + + swapDevices = [ + { device = "/dev/disk/by-uuid/6c09b90f-8971-4702-a18a-f06dfb3d8dcd"; } + ]; + + nix.maxJobs = lib.mkDefault 8; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = true; +} diff --git a/machines/kholinar/secret.nix b/machines/kholinar/secret.nix new file mode 100644 index 00000000..e1cce260 Binary files /dev/null and b/machines/kholinar/secret.nix differ diff --git a/machines/oldtown/default.nix b/machines/oldtown/default.nix index 1e82b53f..97f77fa3 100644 --- a/machines/oldtown/default.nix +++ b/machines/oldtown/default.nix @@ -5,6 +5,7 @@ ./hardware.nix ./secret.nix + ../../configurations/eid.nix ../../profiles/bluetooth/default.nix ../../profiles/common/default.nix ../../profiles/graphical/default.nix diff --git a/machines/pentos/hardware.nix b/machines/pentos/hardware.nix deleted file mode 100644 index fe7e4ac6..00000000 --- a/machines/pentos/hardware.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = [ ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; - # Early KMS start - boot.initrd.kernelModules = [ "i915" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/0eb8b94a-5fc2-4b24-962a-94b3675b6f5b"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/46AC-2E2E"; - fsType = "vfat"; - }; - - swapDevices = [ - { device = "/dev/disk/by-uuid/b8f6154e-6b1f-42d7-8fe0-c03d7ad150f3"; } - ]; - - nix.maxJobs = lib.mkDefault 8; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = true; -} diff --git a/machines/pentos/secret.nix b/machines/pentos/secret.nix deleted file mode 100644 index fa477ee0..00000000 Binary files a/machines/pentos/secret.nix and /dev/null differ diff --git a/modules/zfs.nix b/modules/zfs.nix new file mode 100644 index 00000000..94d6d033 --- /dev/null +++ b/modules/zfs.nix @@ -0,0 +1,56 @@ +{ config, lib, ... }: + +{ + options.custom.zfs = { + enable = lib.mkOption { + default = false; + example = true; + }; + encrypted = lib.mkOption { + default = false; + example = true; + }; + systemLinks = lib.mkOption { + default = [ ]; + example = [ + { path = "/var/lib/docker"; type = "cache"; } + { path = "/var/lib/docker/volumes"; type = "data"; } + ]; + }; + homeLinks = lib.mkOption { + default = [ ]; + example = [ + { path = ".config/syncthing"; type = "data"; } + { path = ".cache/nix-index"; type = "cache"; } + ]; + }; + }; + + config.boot = lib.mkIf config.custom.zfs.enable { + supportedFilesystems = [ "zfs" ]; + zfs.requestEncryptionCredentials = config.custom.zfs.encrypted; + initrd.postDeviceCommands = lib.mkAfter '' + zfs rollback -r rpool/local/root@blank + ''; + }; + + config.services.zfs.autoScrub.enable = config.custom.zfs.enable; + config.services.zfs.trim.enable = config.custom.zfs.enable; + + config.environment.etc = lib.mkIf config.custom.zfs.enable { + nixos = { source = "/data/etc/nixos/"; }; + }; + + config.systemd.tmpfiles.rules = lib.mkIf config.custom.zfs.enable ( + [ "d /home/charlotte 0700 charlotte users - -" ] ++ + (map (location: "L ${location.path} - - - - /${location.type}${location.path}") config.custom.zfs.systemLinks) + ); + + config.home-manager.users.charlotte = { ... }: { + systemd.user.tmpfiles.rules = lib.mkIf config.custom.zfs.enable ( + map + (location: "L /home/charlotte/${location.path} - - - - /${location.type}/home/charlotte/${location.path}") + config.custom.zfs.homeLinks + ); + }; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 00000000..3f2952c1 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,14 @@ +{ ... }: +let + overlays = [ + (import ./pass.nix) + (import ./ssh.nix) + ]; +in +{ + nixpkgs.overlays = overlays; + + home-manager.users.charlotte = { pkgs, ... }: { + nixpkgs.overlays = overlays; + }; +} diff --git a/overlays/pass.nix b/overlays/pass.nix new file mode 100644 index 00000000..359ea925 --- /dev/null +++ b/overlays/pass.nix @@ -0,0 +1,4 @@ +self: super: { + firefox = super.firefox.override { extraNativeMessagingHosts = [ self.passff-host ]; }; + pass = (super.pass-wayland.override { pass = super.pass-wayland; }).withExtensions (ext: [ ext.pass-otp ]); +} diff --git a/overlays/ssh.nix b/overlays/ssh.nix new file mode 100644 index 00000000..aa2eebe1 --- /dev/null +++ b/overlays/ssh.nix @@ -0,0 +1,16 @@ +self: super: { + ssh = self.symlinkJoin { + name = "openssh"; + paths = [ + ( + self.writeScriptBin "ssh" '' + #!${self.zsh}/bin/zsh + + export TERM=xterm-256color + ${super.openssh}/bin/ssh $@ + '' + ) + super.openssh + ]; + }; +} diff --git a/packages/kotlin-language-server/gradle-env.nix b/packages/kotlin-language-server/gradle-env.nix index 81df4b81..ca85c5af 100644 --- a/packages/kotlin-language-server/gradle-env.nix +++ b/packages/kotlin-language-server/gradle-env.nix @@ -84,30 +84,30 @@ let (id: "${replaceStrings [ "." ] [ "/" ] id.group}/${id.name}/maven-metadata.xml") ids; in - attrValues - ( - mapAttrs - ( - path: meta: - let - versions' = sort versionOlder (unique meta.versions); - in - with meta; writeTextDir path '' - - - ${groupId} - ${artifactId} - - ${optionalString (latest != "") "${latest}"} - ${optionalString (release != "") "${release}"} - - ${concatMapStringsSep "\n " (v: "${v}") versions'} - - - - '' - ) modules - ); + attrValues ( + mapAttrs + ( + path: meta: + let + versions' = sort versionOlder (unique meta.versions); + in + with meta; writeTextDir path '' + + + ${groupId} + ${artifactId} + + ${optionalString (latest != "") "${latest}"} + ${optionalString (release != "") "${release}"} + + ${concatMapStringsSep "\n " (v: "${v}") versions'} + + + + '' + ) + modules + ); mkSnapshotMetadata = deps: let snapshotDeps = filter (dep: dep ? build && dep ? timestamp) deps; @@ -156,31 +156,31 @@ let ''; in - attrValues - ( - mapAttrs - ( - path: meta: - with meta; writeTextDir path '' - - - ${groupId} - ${artifactId} - ${version} - - - ${optionalString (timestamp != "") "${timestamp}"} - ${optionalString (buildNumber != -1) "${toString buildNumber}"} - - ${optionalString (lastUpdated != "") "${lastUpdated}"} - - ${concatMapStringsSep "\n " mkSnapshotVersion versions} - - - - '' - ) modules - ); + attrValues ( + mapAttrs + ( + path: meta: + with meta; writeTextDir path '' + + + ${groupId} + ${artifactId} + ${version} + + + ${optionalString (timestamp != "") "${timestamp}"} + ${optionalString (buildNumber != -1) "${toString buildNumber}"} + + ${optionalString (lastUpdated != "") "${lastUpdated}"} + + ${concatMapStringsSep "\n " mkSnapshotVersion versions} + + + + '' + ) + modules + ); mkRepo = project: type: deps: buildEnv { name = "${project}-gradle-${type}-env"; paths = map mkDep deps ++ mkModuleMetadata deps ++ mkSnapshotMetadata deps; @@ -248,32 +248,31 @@ let pname = args.pname or projectEnv.name; version = args.version or projectEnv.version; in -stdenv.mkDerivation - ( - args // { +stdenv.mkDerivation ( + args // { - inherit pname version; + inherit pname version; - nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ projectEnv.gradle ]; + nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ projectEnv.gradle ]; - buildPhase = args.buildPhase or '' - runHook preBuild + buildPhase = args.buildPhase or '' + runHook preBuild - ( - set -x - env \ - "GRADLE_USER_HOME=$(mktemp -d)" \ - gradle --offline --no-daemon --no-build-cache \ - --info --full-stacktrace --warning-mode=all \ - ${optionalString enableParallelBuilding "--parallel"} \ - ${optionalString enableDebug "-Dorg.gradle.debug=true"} \ - --init-script ${projectEnv.initScript} \ - ${concatStringsSep " " gradleFlags} - ) + ( + set -x + env \ + "GRADLE_USER_HOME=$(mktemp -d)" \ + gradle --offline --no-daemon --no-build-cache \ + --info --full-stacktrace --warning-mode=all \ + ${optionalString enableParallelBuilding "--parallel"} \ + ${optionalString enableDebug "-Dorg.gradle.debug=true"} \ + --init-script ${projectEnv.initScript} \ + ${concatStringsSep " " gradleFlags} + ) - runHook postBuild - ''; + runHook postBuild + ''; - dontStrip = true; - } - ) + dontStrip = true; + } +) diff --git a/packages/node/node-env.nix b/packages/node/node-env.nix index 9a6e1926..7e1b12f1 100644 --- a/packages/node/node-env.nix +++ b/packages/node/node-env.nix @@ -5,7 +5,8 @@ let python = if nodejs ? python then nodejs.python else python2; # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise - tarWrapper = runCommand "tarWrapper" { } '' + tarWrapper = runCommand "tarWrapper" + { } '' mkdir -p $out/bin cat > $out/bin/tar <