diff --git a/common/default.nix b/common/default.nix new file mode 100644 index 0000000..5fbf46a --- /dev/null +++ b/common/default.nix @@ -0,0 +1,272 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inputs = config.inputInjection.flake-inputs; + unstable = inputs.nixos-unstable; +in +{ + imports = [ + ./packages.nix + ./nitrokey.nix + ./nix-settings.nix + ./upgrade-diff.nix + ./guest.nix + ]; + + services.davfs2.enable = true; + + # exfat support + #boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; + + # make the boot look good + boot.plymouth.enable = true; + + # configure console + console = { + font = "Lat2-Terminus16"; + keyMap = "de"; + }; + + # Select internationalisation properties. + i18n = { + defaultLocale = "de_DE.UTF-8"; + }; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + programs.bash.completion.enable = true; + programs.wireshark = { + enable = true; + package = pkgs.wireshark; + }; + + programs.adb.enable = true; + + programs.mtr.enable = true; + # programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; + + programs.ausweisapp = { + enable = true; + openFirewall = true; + }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + programs.ssh.startAgent = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + networking.firewall.allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + networking.firewall.allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; # for KDE connect + # FIXME: kdeconnect module + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + networking.networkmanager = { + enable = true; + # FIXME: move into own file, use SOPS for secrets + ensureProfiles.profiles = { + "37C3" = { + connection = { + id = "37C3"; + type = "wifi"; + interface-name = "wlan0"; + }; + wifi = { + mode = "infrastructure"; + ssid = "37C3"; + }; + wifi-security = { + auth-alg = "open"; + key-mgmt = "wpa-eap"; + }; + "802-1x" = { + anonymous-identity = "37C3"; + eap = "ttls;"; + identity = "37C3"; + password = "37C3"; + phase2-auth = "pap"; + altsubject-matches = "DNS:radius.c3noc.net"; + ca-cert = "${builtins.fetchurl { + url = "https://letsencrypt.org/certs/isrgrootx1.pem"; + sha256 = "sha256:1la36n2f31j9s03v847ig6ny9lr875q3g7smnq33dcsmf2i5gd92"; + }}"; + }; + ipv4 = { + method = "auto"; + }; + ipv6 = { + addr-gen-mode = "default"; + method = "auto"; + }; + }; + }; + }; + + services.avahi.enable = true; + + # Enable CUPS to print documents. + services.printing = { + enable = true; + drivers = [ pkgs.hplip ]; + }; + # scanners + hardware.sane = { + enable = true; + extraBackends = [ pkgs.hplip ]; + }; + + # Bluetooth + hardware.bluetooth = { + enable = true; + settings.General.Disable = "Headset"; # disable headset profile + }; + + # FIXME: at some point, hide GUI and sound (desktop vs. server) behind an option + # Enable the X11 windowing system. + services.xserver = { + enable = true; + xkb.layout = "de"; + xkb.options = "eurosign:e"; + }; + + # Enable touchpad support. + services.libinput.enable = true; + + # while libinput also supports graphic tablets, enable more-specific wacom driver + services.xserver.wacom.enable = true; + + # Enable the KDE Desktop Environment. + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + }; + services.desktopManager.plasma6.enable = true; + # TODO: move out into a plasma.nix module + programs.kde-pim = { + enable = true; + kmail = true; + kontact = true; + merkuro = true; + }; + # enable wayland for Chromium and Electron + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # dconf required for several Gnome applications + programs.dconf.enable = true; + + programs.firefox.enable = true; # enables support for automatically setting additionsl nativeMessagingHosts + + # Flatpak support + services.flatpak.enable = true; + xdg.portal.extraPortals = [ pkgs.kdePackages.xdg-desktop-portal-kde ]; + + # Define a user account. Don't forget to set a password with `passwd`. + users.users.spiollinux = { + isNormalUser = true; + uid = 1000; + extraGroups = [ + "vboxusers" + "wheel" + "networkmanager" + "scanner" + "lp" + "wireshark" + "dialout" + "cdrom" + "input" + "adbusers" + ]; + shell = pkgs.zsh; + }; + + # enable virtualbox support + virtualisation.virtualbox.host = { + enable = true; + #enableExtensionPack = true; + }; + # allow PUEL license + nixpkgs.config.whitelistedLicenses = [ pkgs.lib.licenses.virtualbox-puel ]; + users.extraGroups.vboxusers.members = [ "spiollinux" ]; + + programs.zsh = { + enable = true; + autosuggestions.enable = true; + }; + + # profile sync daemon + services.psd.enable = true; + + fonts = { + fontDir.enable = true; + fontconfig.enable = true; + fontconfig.includeUserConf = true; + }; + + # Enable all sysrq functions (useful to recover from some issues): + boot.kernel.sysctl."kernel.sysrq" = 1; # NixOS default: 16 (only the sync command) + + nix.package = pkgs.lix; + + nix.settings.trusted-users = [ "spiollinux" ]; + # override tmpdir for daemon + #systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp"; + + # remote builders + #nix.buildMachines = [ + # { + # hostName = "build01.nix-community.org"; + # sshUser = "ssh-ng://schmittlauch"; + # sshKey = "/root/.ssh/remote_builder_key"; + # system = "x86_64-linux"; + # maxJobs = 64; + # supportedFeatures = [ + # "big-parallel" + # "kvm" + # "nixos-test" + # ]; + # } + #]; + programs.ssh.knownHosts."build01.nix-community.org".publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIElIQ54qAy7Dh63rBudYKdbzJHrrbrrMXLYl7Pkmk88H"; + + # package debugging + # programs.sysdig.enable = true; + + # declarative containers + containers = { + # hash2PubSim = import ./Hash2PubTestbed.nix + # { + # inherit pkgs config; + # experimentUid = config.users.users.spiollinux.uid; + # projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW"; + # }; + }; + + # stop NetworkManager from managing virtual interfaces + networking.networkmanager.unmanaged = [ "interface-name:ve-*" ]; + + services.dbus.implementation = "broker"; +} diff --git a/common/guest.nix b/common/guest.nix new file mode 100644 index 0000000..2084b97 --- /dev/null +++ b/common/guest.nix @@ -0,0 +1,65 @@ +{ + config, + lib, + system, + ... +}: +let + inputs = config.inputInjection.flake-inputs; +in +{ + # interesting: this causes an infinite recursion + #imports = [ config.inputInjection.flake-inputs.home-manager.nixosModules.home-manager ]; + + options.schmittlauch.guestUser.enable = lib.options.mkEnableOption "Provide a guest user account"; + + config = lib.mkIf config.schmittlauch.guestUser.enable { + users.extraUsers.gast = { + isNormalUser = true; + group = "gast"; + hashedPassword = "$y$j9T$pPCjU8ZvVYo0aY4jtrHPj1$NxUWOP/YTcqJ1PYaP1Hy5MwTeDcNjg0k369R5rE5M48"; + }; + users.groups.gast = { }; + # a basic home-manager configuration to share installed packages of other accounts + # reason: keeping a separate config checkout for guests and requiring them to run + # their own `home-manager` instance does not make sense. + home-manager = + let + gast = config.users.extraUsers.gast; + in + { + useGlobalPkgs = false; # to allow usage of home-level overlays + # FIXME: possibly expose home modules through flake outputs instead of brittle path traversals + users.gast = { + imports = [ + ../home/modules/packages.nix + ]; + home = { + username = gast.name; + homeDirectory = gast.home; + stateVersion = "24.05"; + }; + schmittlauch = { + packages = { + graphics = true; + multimedia = true; + nixHelpers = true; + devTools = true; + pythonTools = true; + games = true; + desktopLinux = true; + kde = true; + }; + }; + + }; + # Optionally use extraSpecialArgs + # to pass through arguments to home.nix + extraSpecialArgs = { + inherit inputs system; + }; + + }; + + }; +} diff --git a/common/nitrokey.nix b/common/nitrokey.nix new file mode 100644 index 0000000..40457d1 --- /dev/null +++ b/common/nitrokey.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, ... }: +{ + hardware.nitrokey.enable = true; + environment.systemPackages = [ pkgs.pynitrokey ]; + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "nrfutil" + "pc-ble-driver-py" + "pc-ble-driver" + "pypemicro" + ]; +} diff --git a/common/nix-settings.nix b/common/nix-settings.nix new file mode 100644 index 0000000..caa16f9 --- /dev/null +++ b/common/nix-settings.nix @@ -0,0 +1,38 @@ +# needs to be kept compatible to both NixOS and nix-darwin +{ + config, + pkgs, + lib, + ... +}: + +let + inputs = config.inputInjection.flake-inputs; + unstable = inputs.nixos-unstable; +in +{ + nix = { + # expose all flake inputs through nix Path and registry + registry = (lib.mapAttrs (_: value: { flake = value; }) inputs) // { + nixpkgs.flake = inputs.nixpkgs; + }; + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + }; + nix.settings = builtins.mapAttrs (_: lib.mkDefault) { + # keep around all inputs necessary for offline-rebuilding the system + keep-outputs = true; + keep-derivations = true; + trusted-users = [ "spiollinux" ]; + experimental-features = [ + "nix-command" + "flakes" + ]; + # use all cores for building + cores = 0; + }; + # TODO: manage access token with sops instead of manual deployment + # permissions: needs to be readable by the user invoking nix and root (for nix daemon) + nix.extraOptions = '' + !include /etc/nix/secrets.conf + ''; +} diff --git a/common/packages.nix b/common/packages.nix new file mode 100644 index 0000000..ec4f22b --- /dev/null +++ b/common/packages.nix @@ -0,0 +1,59 @@ +{ + lib, + pkgs, + config, + ... +}: + +{ + # take overlays from flake + nixpkgs.overlays = lib.attrValues config.inputInjection.flake-inputs.self.overlays; + nixpkgs.config.permittedInsecurePackages = [ + # (temporarily) permit the usage of libolm + "olm-3.2.16" + ]; + + # List packages installed in system profile. + environment.systemPackages = with pkgs; [ + wget + vim + vimPlugins.vim-nix + vimPlugins.pathogen + tmux + htop + zsh + btrfs-progs + git + python3 + man-pages + dnsutils + netcat-openbsd + ntfs3g + file + multipath-tools + strace + ltrace + valgrind + testdisk + rsync + pv + exfat + iotop + cifs-utils + dool + lsof + macchanger + borgbackup + + # for debugging WLAN failures: + ethtool + trace-cmd + + # NetworkManager stuff + networkmanager-openconnect + networkmanager-vpnc + networkmanager-openvpn + # for some Flatpak packkages + accountsservice + ]; +} diff --git a/common/pipewire.nix b/common/pipewire.nix new file mode 100644 index 0000000..1fb3c0e --- /dev/null +++ b/common/pipewire.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: +{ + # rtkit is optional but recommended + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + wireplumber.configPackages = [ + (pkgs.writeTextDir "share/wireplumber/bluetooth.lua.d/51-bluez-config.lua" '' + bluez_monitor.properties = { + ["bluez5.enable-sbc-xq"] = true, + ["bluez5.enable-msbc"] = true, + ["bluez5.enable-hw-volume"] = true, + ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" + } + '') + ]; + }; + environment.systemPackages = [ pkgs.easyeffects ]; +} diff --git a/common/pulseaudio.nix b/common/pulseaudio.nix new file mode 100644 index 0000000..7323b57 --- /dev/null +++ b/common/pulseaudio.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: +{ + # Enable sound. + services.pulseaudio = { + enable = true; + package = pkgs.pulseaudioFull; + # decouple pulseaudio application and sink volumes + daemon.config = { + flat-volumes = "no"; + }; + # C3D2 hq music + zeroconf.discovery.enable = true; + zeroconf.publish.enable = true; + }; + services.pipewire.enable = false; # conflicts otherwise +} diff --git a/common/upgrade-diff.nix b/common/upgrade-diff.nix new file mode 100644 index 0000000..a66725f --- /dev/null +++ b/common/upgrade-diff.nix @@ -0,0 +1,9 @@ +# MIT Jörg Thalheim - https://github.com/Mic92/dotfiles/blob/c6cad4e57016945c4816c8ec6f0a94daaa0c3203/nixos/modules/upgrade-diff.nix +{ pkgs, ... }: +{ + system.activationScripts.diff = '' + if [[ -e /run/current-system ]]; then + ${pkgs.nix}/bin/nix store diff-closures /run/current-system "$systemConfig" + fi + ''; +} diff --git a/darwin/configuration.nix b/darwin/configuration.nix new file mode 100644 index 0000000..307836f --- /dev/null +++ b/darwin/configuration.nix @@ -0,0 +1,52 @@ +{ config, pkgs, ... }: + +{ + imports = [ ../common/nix-settings.nix ]; + nix = { + enable = true; + settings = { + trusted-users = [ + "os" + "@admin" + ]; # @admin for linux-builder + substituters = [ + "https://s3.whq.fcio.net/hydra" + "https://hydra.flyingcircus.io" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "flyingcircus.io-1:Rr9CwiPv8cdVf3EQu633IOTb6iJKnWbVfCC8x8gVz2o=" + ]; + }; + }; + + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = [ pkgs.vim ]; + + # Use a custom configuration.nix location. + # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix + # environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix"; + + # Create /etc/bashrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + + # system-wide SSH configuration, used by nix-daemon for remote builders + + # show hidden files + system.primaryUser = "os"; + system.defaults.NSGlobalDomain.AppleShowAllFiles = true; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + nixpkgs.hostPlatform = "aarch64-darwin"; + + # local vm-backed linux builder as background service + nix.linux-builder = { + enable = true; + ephemeral = true; + maxJobs = 3; + }; + +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..57216c2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,435 @@ +{ + "nodes": { + "crane": { + "locked": { + "lastModified": 1731098351, + "narHash": "sha256-HQkYvKvaLQqNa10KEFGgWHfMAbWBfFp+4cAgkut+NNE=", + "owner": "ipetkov", + "repo": "crane", + "rev": "ef80ead953c1b28316cc3f8613904edc2eb90c28", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nur", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748665073, + "narHash": "sha256-RMhjnPKWtCoIIHiuR9QKD7xfsKb3agxzMfJY8V9MOew=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "282e1e029cb6ab4811114fc85110613d72771dea", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, + "lanzaboote": { + "inputs": { + "crane": "crane", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1737639419, + "narHash": "sha256-AEEDktApTEZ5PZXNDkry2YV2k6t0dTgLPEmAZbnigXU=", + "owner": "nix-community", + "repo": "lanzaboote", + "rev": "a65905a09e2c43ff63be8c0e86a93712361f871e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "v0.4.2", + "repo": "lanzaboote", + "type": "github" + } + }, + "mysecrets": { + "flake": false, + "locked": { + "lastModified": 1722419972, + "narHash": "sha256-7gKcSKTu7Z6sswIK4QuMHtDbpKMs09b6w7uFjJJyAIA=", + "ref": "refs/heads/master", + "rev": "c725f810bb9a43c213fcf964f036dd0c64b6ba04", + "revCount": 5, + "type": "git", + "url": "ssh://gitea@git.orlives.de:2342/schmittlauch/home-manager_secrets.git" + }, + "original": { + "type": "git", + "url": "ssh://gitea@git.orlives.de:2342/schmittlauch/home-manager_secrets.git" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748373722, + "narHash": "sha256-qi6aDGP2W6GyAUNEhg+slQWEpUiJ8LNIrQkmxHpzadI=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "75b99daa12b1fffd646d6c3cf13b06f1fa5cef63", + "type": "github" + }, + "original": { + "owner": "LnL7", + "ref": "nix-darwin-25.05", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1748942041, + "narHash": "sha256-HEu2gTct7nY0tAPRgBtqYepallryBKR1U8B4v2zEEqA=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "fc7c4714125cfaa19b048e8aaf86b9c53e04d853", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixos-unstable": { + "locked": { + "lastModified": 1748693115, + "narHash": "sha256-StSrWhklmDuXT93yc3GrTlb0cKSS0agTAxMGjLKAsY8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "910796cabe436259a29a72e8d3f5e180fc6dfacc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1731919951, + "narHash": "sha256-vOM6ETpl1yu9KLi/icTmLJIPbbdJCdAVYUXZceO/Ce4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "04386ac325a813047fc314d4b4d838a5b1e3c7fe", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1748889542, + "narHash": "sha256-Hb4iMhIbjX45GcrgOp3b8xnyli+ysRPqAgZ/LZgyT5k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "10d7f8d34e5eb9c0f9a0485186c1ca691d2c5922", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1748693115, + "narHash": "sha256-StSrWhklmDuXT93yc3GrTlb0cKSS0agTAxMGjLKAsY8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "910796cabe436259a29a72e8d3f5e180fc6dfacc", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_3", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1748973087, + "narHash": "sha256-ZN0XKKdCBC9eLeog7qYhfGPbajkPtQPdlxp/dhwONw4=", + "owner": "nix-community", + "repo": "NUR", + "rev": "90add46380908ba4395f5f1dfec84224a3b0d4b9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": [ + "lanzaboote", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1731363552, + "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "lanzaboote": "lanzaboote", + "mysecrets": "mysecrets", + "nix-darwin": "nix-darwin", + "nixos-hardware": "nixos-hardware", + "nixos-unstable": "nixos-unstable", + "nixpkgs": "nixpkgs_2", + "nur": "nur", + "treefmt-nix": "treefmt-nix_2", + "utils": "utils" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731897198, + "narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "0be641045af6d8666c11c2c40e45ffc9667839b5", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nur", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733222881, + "narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "49717b5af6f80172275d47a418c9719a31a78b53", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748243702, + "narHash": "sha256-9YzfeN8CB6SzNPyPm2XjRRqSixDopTapaRsnTpXUEY8=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "1f3f7b784643d488ba4bf315638b2b0a4c5fb007", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 4d5b7d3..20809d2 100644 --- a/flake.nix +++ b/flake.nix @@ -2,55 +2,207 @@ description = "NixOS system flake"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; home-manager = { - url = "github:nix-community/home-manager/release-22.11"; + url = "github:nix-community/home-manager/release-25.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + lanzaboote = { + url = "github:nix-community/lanzaboote/v0.4.2"; + # deliberately do _not_ follow the nixpkgs input here, because paranoia and test coverage + }; + utils.url = "github:numtide/flake-utils"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-darwin = { + url = "github:LnL7/nix-darwin/nix-darwin-25.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nur.url = "github:nix-community/NUR"; # TODO: possible make this a flake as well mysecrets = { flake = false; url = "git+ssh://gitea@git.orlives.de:2342/schmittlauch/home-manager_secrets.git"; }; - }; - outputs = - { self, nixpkgs, nur, ... }@inputs: - let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in - { + outputs = + { + self, + nixpkgs, + nur, + lanzaboote, + utils, + home-manager, + treefmt-nix, + nix-darwin, + ... + }@inputs: + let + # FIXME: allow different systems + systems = utils.lib.system; + + # ability to extend nixpkgs with patches, e.g. from PRs or staging. See https://ertt.ca/nix/patch-nixpkgs/ + mkNixpkgs-patched = + system: + (import nixpkgs { inherit system; }).applyPatches { + name = "nixpkgs-patched"; + src = nixpkgs; + patches = [ ./patches/keepassxc-fix-darwin-build.patch ]; + }; - nixosConfigurations.thinknix = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ ./nixos/configuration.nix ]; # necessary to make the top-level inputs available to system configuration - specialArgs = { inherit inputs; }; - }; - homeConfigurations.spiollinux = inputs.home-manager.lib.homeManagerConfiguration { - inherit pkgs; - - modules = [ + # inspired by https://jade.fyi/blog/flakes-arent-real/ + inputInjection = + { pkgs, lib, ... }: { - imports = [ - nur.hmModules.nur - ./home/home.nix - ]; - # extends the home config - home.username = "spiollinux"; - home.homeDirectory = "/home/spiollinux"; - } + options.inputInjection = lib.mkOption { + type = with lib.types; attrsOf unspecified; + default = { }; + }; + config.inputInjection = { + flake-inputs = inputs; + }; + }; + defaultModules = system: [ + inputInjection + + # for some reason, `imports`-ing the home-manager module via inputInjection + # from a sub-module causes infinite recursion, so importing it here instead + home-manager.nixosModules.home-manager ]; - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - extraSpecialArgs = { - inherit inputs; + mkSystem = + system: extraModules: + nixpkgs.lib.nixosSystem rec { + modules = (defaultModules system) ++ extraModules; + inherit system; + specialArgs = { + inherit system; + }; + }; + mkHomeManager = + confName: user: system: # unfortunately, home-manager configs are still system-specific + home-manager.lib.homeManagerConfiguration { + pkgs = import (mkNixpkgs-patched system) { inherit system; }; + modules = [ + { + imports = [ + ./home/common.nix + ./home/${confName}.nix + ]; + # extends the home config + home.username = user; + } + ]; + # Optionally use extraSpecialArgs + # to pass through arguments to home.nix + extraSpecialArgs = { + inherit inputs system; + }; + }; + treefmtConf = + { pkgs, ... }: + { + projectRootFile = "flake.nix"; + programs.nixfmt.enable = true; + }; + in + { + overlays.default = import ./packages; + nixosConfigurations = { + thinknix = mkSystem systems.x86_64-linux [ + ./hosts/thinknix + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440s + lanzaboote.nixosModules.lanzaboote + ]; + framenix = mkSystem systems.x86_64-linux [ + ./hosts/framenix + inputs.nixos-hardware.nixosModules.framework-13-7040-amd + lanzaboote.nixosModules.lanzaboote + ]; }; - }; - }; + darwinConfigurations."OS-MacBook-Pro" = nix-darwin.lib.darwinSystem { + modules = [ + ./darwin/configuration.nix + inputInjection + + ]; + }; + homeConfigurations = { + spiollinux-desktop = mkHomeManager "desktop" "spiollinux" systems.x86_64-linux; + os-workmac = mkHomeManager "workmac" "os" systems.aarch64-darwin; + }; + lib = { + inherit mkHomeManager; + }; + } + // utils.lib.eachDefaultSystem ( + system: + let + nixpkgs = import inputs.nixpkgs { + inherit system; + overlays = nixpkgs.lib.attrValues self.overlays; + }; + nixpkgs_unstable = import inputs.nixos-unstable { + inherit system; + overlays = nixpkgs.lib.attrValues self.overlays; + }; + pkgs = inputs.nixpkgs.legacyPackages.${system}; + pkgs_unstable = inputs.nixos-unstable.legacyPackages.${system}; + treefmtEval = treefmt-nix.lib.evalModule pkgs_unstable treefmtConf; + in + { + devShells.default = pkgs.mkShell { buildInputs = [ ]; }; + formatter = treefmtEval.config.build.wrapper; + checks.formatting = treefmtEval.config.build.check self; + # expose nixpkgs with overlay; TODO: figure out role of config + #legacyPackages = nixpkgs; + + # inspired by https://github.com/Mic92/dotfiles/blob/main/home-manager/flake-module.nix + # run like: `nix run .#hm -- ` + apps.hm = { + type = "app"; + program = "${pkgs.writeShellScriptBin "hm" '' + set -x + export PATH=${ + pkgs.lib.makeBinPath [ + pkgs.git + pkgs.coreutils + pkgs.findutils + pkgs.lix + pkgs.jq + pkgs.unixtools.hostname + ] + } + declare -A profiles=( + ["framenix"]="spiollinux-desktop" + ["thinknix"]="spiollinux-desktop" + ["OS MacBook Pro"]="os-workmac" + ) + user=$(id -un) + host=$(hostname) + if [[ -n ''${profiles["$host-$user"]} ]]; then + profile=''${profiles["$host-$user"]}; + elif [[ -n ''${profiles[$host]:-} ]]; then + profile=''${profiles[$host]} + else + echo "No suitable profile found." >2 + exit 2 + fi + if [[ "''${1:-}" == profile ]]; then + echo $profile + exit 0 + fi + ${ + inputs.home-manager.packages.${pkgs.system}.home-manager + }/bin/home-manager --flake "${self}#$profile" "$@" + ''}/bin/hm"; + }; + } + ); } diff --git a/home/common.nix b/home/common.nix new file mode 100644 index 0000000..c2c5264 --- /dev/null +++ b/home/common.nix @@ -0,0 +1,177 @@ +{ + pkgs, + inputs, + config, + system, + lib, + ... +}: +{ + imports = [ + ./modules/packages.nix + ./modules/vscodium.nix + ./modules/fonts.nix + ]; + home.homeDirectory = + if pkgs.stdenv.isDarwin then "/Users/${config.home.username}" else "/home/${config.home.username}"; + programs.home-manager.enable = true; + + programs.bat.enable = true; + programs.direnv = { + enable = true; + nix-direnv.enable = true; + enableZshIntegration = true; + }; + + programs.tmux = { + enable = true; + keyMode = "vi"; + extraConfig = + # for direnv not messing up the environment + '' + set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES" + set-environment -gu DIRENV_DIFF + set-environment -gu DIRENV_DIR + set-environment -gu DIRENV_WATCHES + set-environment -gu DIRENV_LAYOUT + + bind-key -T copy-mode-vi 'v' send -X begin-selection + bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel''; + terminal = "screen-256color"; + }; + + programs.git = { + enable = true; + extraConfig = { + credential.helper = "cache"; + push.default = "simple"; + push.forceIfIncludes = true; # avoid accidental force overrides when remote is autofetched in background + init.defaultBranch = "mainline"; + diff.tool = "vimdiff"; + merge.tool = "vimdiff"; + # provide `git mergetool -t nixfmt` + mergetool.nixfmt = { + cmd = "${lib.getExe pkgs.nixfmt-rfc-style} --mergetool \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\""; + trustExitCode = true; + }; + core.excludesfile = toString ( + pkgs.writeText ".gitignore_global" '' + # Direnv stuff # + ################ + .direnv + .envrc + # Editor files # + ################ + *~ + *.swp + *.swo + # macOS foo # + ############# + .DS_Store + '' + ); + core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab"; + rerere.enabled = true; + }; + lfs.enable = true; + delta = { + enable = true; + options = { + line-numbers = true; + side-by-side = true; + #dark = true; + }; + }; + }; + programs.lazygit = { + enable = true; + settings = { + git = { + autoFetch = false; + mainBranches = [ + "main" + "master" + "mainline" + ]; + }; + update.method = "never"; + }; + }; + + # shell config + programs.zsh = { + enable = true; + syntaxHighlighting.enable = true; + history.ignoreSpace = true; + initContent = '' + # Uncomment following line if you want red dots to be displayed while waiting for completion + COMPLETION_WAITING_DOTS="true" + ### Fix slowness of pastes with zsh-syntax-highlighting.zsh + pasteinit() { + OLD_SELF_INSERT=''${''${(s.:.)widgets[self-insert]}[2,3]} + zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`? + } + + pastefinish() { + zle -N self-insert $OLD_SELF_INSERT + } + zstyle :bracketed-paste-magic paste-init pasteinit + zstyle :bracketed-paste-magic paste-finish pastefinish + + # automatic rehash of path completion + zstyle ':completion:*' rehash true + + eval "$(${pkgs.thefuck}/bin/thefuck --alias)" + + ## helper functions + nixify() { + if [ ! -e ./.envrc ]; then + echo "eval \"$(lorri direnv)\"" > .envrc + direnv allow + fi + if [ ! -e shell.nix ]; then + cat > shell.nix <<'EOF' + with import {}; + mkShell { + buildInputs = [ + bashInteractive + ]; + } + EOF + ${"EDITOR:-vim"} default.nix + fi + } + + binpath() { + realpath $(${pkgs.which}/bin/which $1) + } + ''; + + oh-my-zsh = { + enable = true; + theme = "bira"; + plugins = [ + "git" + "python" + "systemd" + "gpg-agent" + ]; + }; + }; + home.shellAliases = { + ip = "ip --color"; + ipb = "ip --color --brief"; + ll = "ls -l"; + wavesynth = "nix-shell -p sox --run 'play -n synth brownnoise synth pinknoise mix synth 0 0 0 15 40 80 trapezium amod 0.2 20'"; + vim = "nvim"; + }; + home.sessionVariables = { + EDITOR = "nvim"; + }; + + home.activation.reportChanges = config.lib.dag.entryAnywhere '' + if [[ -v oldGenPath ]]; then + run nix store diff-closures $oldGenPath $newGenPath + fi + ''; +} diff --git a/home/config.nix b/home/config.nix deleted file mode 100644 index 66a4143..0000000 --- a/home/config.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, ...}: -{ - - firefox.enablePlasmaBrowserIntegration = true; - firefox-bin.enablePlasmaBrowserIntegration = true; - clementine.spotify = false; - vim = - { gui = "gtk3"; - python = true; - multibyteSupport = true; - }; - } diff --git a/home/desktop.nix b/home/desktop.nix new file mode 100644 index 0000000..1e089e7 --- /dev/null +++ b/home/desktop.nix @@ -0,0 +1,86 @@ +{ + pkgs, + inputs, + config, + system, + lib, + ... +}: +{ + imports = [ ./modules/latex.nix ]; + home.stateVersion = "23.11"; + + schmittlauch = { + packages = { + graphics = true; + multimedia = true; + nixHelpers = true; + devTools = true; + pythonTools = true; + games = true; + desktopLinux = true; + kde = true; + }; + latex.guiTools = true; + }; + + # for backwards compatibility + services.lorri.enable = true; + + programs.git = + let + # TODO profile specific + contacts = import "${inputs.mysecrets}/contacts.nix" { inherit lib; }; + in + { + includes = + [ + { + condition = "gitdir:~/Seafile/Studium/"; + contents = { + user.name = contacts.personal.name; + user.email = contacts.uni.email; + }; + } + { + condition = "gitdir:~/src/nixpkgs/"; + contents = { + user.name = "Trolli Schmittlauch"; + user.email = contacts.nixOs.email; + }; + } + ] + # set default name for several other common locations + ++ + map + (dir: { + condition = "gitdir:${dir}"; + contents = { + user = { + inherit (contacts.schmittlauch) email name; + }; + }; + }) + [ + "~/src/" + "~/bin/" + "~/tmp/" + "~/nixconfigs/" + ]; + }; + + services.gpg-agent = { + enable = true; + #enableSshSupport = true; + pinentry.package = pkgs.pinentry-qt; + }; + + programs.ssh = { + enable = true; + # ssh host config + matchBlocks = (import "${inputs.mysecrets}/ssh_hosts.nix").privateHosts; + }; + + # media button control support from Bluetooth devices + services.mpris-proxy.enable = true; +} diff --git a/home/home.nix b/home/home.nix deleted file mode 100644 index 9a87b78..0000000 --- a/home/home.nix +++ /dev/null @@ -1,449 +0,0 @@ -{ pkgs, inputs, config, ... }: - -with pkgs; -let - # nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable - unstable = inputs.nixos-unstable; - - desktopApps = [ - firefox - chromium - falkon - thunderbird - calibre - dino - zotero - keepassxc - ding - aspell - aspellDicts.de - aspellDicts.en - # for kate/KDE applications - hunspellDicts.de-de - hunspellDicts.en-us - hunspellDicts.en-gb-ise - seafile-client - alacritty - libreoffice-qt # fresh with KDE integration - backintime-common - anki-bin - signal-desktop - (tor-browser-bundle-bin.override { - mediaSupport = true; - pulseaudioSupport = true; - # prevent segfault on Intel graphics systems - useHardenedMalloc = false; - }) - pdfpc - quaternion - nheko - gpx-viewer - gpxsee - cawbird - subsurface - yate - # split and merge PDFs in a GUI - pdfarranger - qbittorrent - #(pkgs.pidgin-with-plugins.override { - # plugins = [ pkgs.pidginotr ];}) - - - # for Hibiscus banking software - jameica - #ToDo: which of these drivers is actually used? - geckodriver - chromedriver - ]; - - graphicsApps = [ - inkscape - darktable - hugin - luminanceHDR - exiftool - gimp - xournal - ] - ++ ( - with gimpPlugins; [ - resynthesizer - fourier - lqrPlugin - ] - ); - - multimediaApps = [ - mpv - vlc - #amarok - clementine - elisa - yt-dlp - #sonic-pi - musescore - audacity - avidemux - #linphone - soundkonverter - ]; - - cliApps = [ - myVim - htop - tmux - httpie - ponysay - gti - tree - lsof - mosh - openssh - sshfs-fuse - cryfs - smbnetfs # for FUSE smb mounting - sshuttle - thefuck - gnupg - unar - lzop - p7zip - pwgen - pandoc - agrep - pdfgrep - torsocks - ncdu - psmisc # for killall - dos2unix - reptyr # re-bind running program to other tty - xclip - unzip - config.nur.repos.schmittlauch.lolcommits # from NUR - ]; - - nixHelpers = [ - lorri - nix-review - nixpkgs-fmt - nix-top - statix - ]; - - kdeTools = with plasma5Packages; with kdeGear; [ - okular - gwenview - yakuake - kmail - kontact - korganizer - akonadi-mime #for KOrganizer - kaddressbook - kdeconnect - dolphin - spectacle - kate - kleopatra - qdirstat - ark - kwalletmanager - ktouch - kcharselect - konversation - okteta - krdc - skanlite - akonadiconsole - plasma-browser-integration - ] - ++ ( - with kdeFrameworks; [ - networkmanager-qt - kcrash - breeze-gtk - phonon-backend-vlc - #(phonon-backend-vlc.override {qtbase=qt5.qtbase; qtx11extras=qt5.qtx11extras;}) - ] - ); - - devTools = [ - curl - httpie - gdb - strace - ltrace - valgrind - zeal - gcc - shellcheck - mtr - ripgrep - gitui - lazygit - pre-commit - - # Haskell - ghc - cabal2nix - ]; - - - latexApps = [ - texmaker - kile - biber - # customize texlive installation - ( - texlive.combine { - inherit (texlive) - scheme-medium - - xetex - luatex - unicode-math - fontspec - collection-binextra - collection-fontsrecommended - collection-latex - collection-latexextra - collection-latexrecommended - collection-langgerman - moderncv - fontawesome5 - academicons - acronym - ccicons - fontawesome - biblatex - logreq - koma-script - ; - } - ) - ]; - - pythonApps = with python3Packages; [ - notebook - ipython - pip - numpy - matplotlib - jedi - flake8 - mypy - ]; - - - fonts = [ - comic-neue - source-sans-pro - source-serif-pro - fira-code - ubuntu_font_family - twemoji-color-font - open-sans - (iosevka-bin.override { - variant = "curly-slab"; - }) - config.nur.repos.schmittlauch.vollkorn - # TODO: humor-sans - ]; - - games = [ - superTuxKart - #hedgewars - ]; - -in -{ - - nixpkgs.overlays = (import ./overlays.nix); - - home.packages = - desktopApps - ++ latexApps - ++ pythonApps - ++ graphicsApps - ++ cliApps - ++ multimediaApps - ++ devTools - ++ kdeTools - ++ fonts - ++ nixHelpers - ++ games - ; - - programs.home-manager.enable = true; - programs.home-manager.path = "$HOME/.nix-defexpr/channels/home-manager"; - home.stateVersion = "22.11"; - - programs.direnv = - { - enable = true; - enableZshIntegration = true; - }; - - # programs.vim = - # { enable = true; - # }; - - programs.bat.enable = true; - - services.gpg-agent = - { - enable = true; - enableSshSupport = true; - pinentryFlavor = "qt"; - }; - - programs.ssh = - { - enable = true; - # ssh host config - matchBlocks = - import "${inputs.mysecrets}/ssh_hosts.nix"; - }; - - programs.tmux = { - enable = true; - keyMode = "vi"; - extraConfig = - # for direnv not messing up the environment - ''set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES" - set-environment -gu DIRENV_DIFF - set-environment -gu DIRENV_DIR - set-environment -gu DIRENV_WATCHES - set-environment -gu DIRENV_LAYOUT - - bind-key -T copy-mode-vi 'v' send -X begin-selection - bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel''; - terminal = "screen-256color"; - }; - - systemd.user.startServices = true; - - services.lorri.enable = true; - - # media button control support from Bluetooth devices - services.mpris-proxy.enable = true; - - fonts.fontconfig.enable = true; - - programs.git = - let contacts = import "${inputs.mysecrets}/contacts.nix"; - in - { - enable = true; - includes = [ - { - condition = "gitdir:~/Seafile/Studium/"; - contents = { - user.name = contacts.realName; - user.email = contacts.uniMail; - }; - } - { - condition = "gitdir:~/src/nixpkgs/"; - contents = { - user.name = "Trolli Schmittlauch"; - user.email = contacts.nixosMail; - }; - } - ] - # set default name for several other common locations - ++ map - (dir: { - condition = "gitdir:${dir}"; - contents = { - user.name = "Trolli Schmittlauch"; - user.email = contacts.mainMail; - }; - }) [ "~/src/" "~/bin/" "~/tmp/" "~/nixconfigs/" ]; - extraConfig = { - credential.helper = "cache"; - push.default = "simple"; - init.defaultBranch = "mainline"; - diff.tool = "vimdiff"; - merge.tool = "vimdiff"; - core.excludesfile = toString (pkgs.writeText ".gitignore_global" '' - # Direnv stuff - .direnv - .envrc - # Editor files # - ################ - *~ - *.swp - *.swo - ''); - core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab"; - }; - lfs.enable = true; - }; - - # shell config - programs.zsh = { - enable = true; - enableSyntaxHighlighting = true; - history.ignoreSpace = true; - initExtra = '' - # Uncomment following line if you want red dots to be displayed while waiting for completion - COMPLETION_WAITING_DOTS="true" - ### Fix slowness of pastes with zsh-syntax-highlighting.zsh - pasteinit() { - OLD_SELF_INSERT=''${''${(s.:.)widgets[self-insert]}[2,3]} - zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`? - } - - pastefinish() { - zle -N self-insert $OLD_SELF_INSERT - } - zstyle :bracketed-paste-magic paste-init pasteinit - zstyle :bracketed-paste-magic paste-finish pastefinish - - # automatic rehash of path completion - zstyle ':completion:*' rehash true - - eval "$(${pkgs.thefuck}/bin/thefuck --alias)" - - ## helper functions - nixify() { - if [ ! -e ./.envrc ]; then - echo "eval \"$(lorri direnv)\"" > .envrc - direnv allow - fi - if [ ! -e shell.nix ]; then - cat > shell.nix <<'EOF' - with import {}; - mkShell { - buildInputs = [ - bashInteractive - ]; - } - EOF - ${EDITOR:-vim} default.nix - fi - } - - binpath() { - realpath $(${pkgs.which}/bin/which $1) - } - ''; - - - oh-my-zsh = { - enable = true; - theme = "bira"; - plugins = [ "git" "python" "systemd" "gpg-agent"]; - }; - }; - home.shellAliases = { - ip = "ip --color"; - ipb = "ip --color --brief"; - ll = "ls -l"; - wavesynth = "nix-shell -p sox --run 'play -n synth brownnoise synth pinknoise mix synth 0 0 0 15 40 80 trapezium amod 0.2 20'"; - vim = "nvim"; - }; - home.sessionVariables = { - EDITOR = "nvim"; - }; -} diff --git a/home/modules/fonts.nix b/home/modules/fonts.nix new file mode 100644 index 0000000..6ce1185 --- /dev/null +++ b/home/modules/fonts.nix @@ -0,0 +1,29 @@ +{ + pkgs, + inputs, + config, + system, + ... +}: +{ + home.packages = with pkgs; [ + comic-neue + source-sans-pro + source-code-pro + source-serif-pro + ubuntu_font_family + twemoji-color-font + open-sans + (iosevka-bin.override { variant = "CurlySlab"; }) + inputs.nur.legacyPackages.${system}.repos.schmittlauch.vollkorn + # TODO: humor-sans + + # fcio corporate design, TODO module + fira-code + fira-mono + # TODO fira-sans + condensed + # TODO museo 500 + ]; + + fonts.fontconfig.enable = true; +} diff --git a/home/modules/latex.nix b/home/modules/latex.nix new file mode 100644 index 0000000..3f79930 --- /dev/null +++ b/home/modules/latex.nix @@ -0,0 +1,47 @@ +{ + pkgs, + inputs, + config, + system, + lib, + ... +}: +with pkgs; +let + latexGuiTools = [ + texmaker + kile + biber + ]; +in +{ + options.schmittlauch.latex.guiTools = lib.mkEnableOption "Install GUI LaTeX tools like editors"; + + config.home.packages = [ + (texlive.combine { + inherit (texlive) + scheme-medium + + xetex + luatex + unicode-math + fontspec + collection-binextra + collection-fontsrecommended + collection-latex + collection-latexextra + collection-latexrecommended + collection-langgerman + moderncv + fontawesome5 + academicons + acronym + ccicons + fontawesome + biblatex + logreq + koma-script + ; + }) + ] ++ lib.optionals config.schmittlauch.latex.guiTools latexGuiTools; +} diff --git a/home/modules/packages.nix b/home/modules/packages.nix new file mode 100644 index 0000000..c44170e --- /dev/null +++ b/home/modules/packages.nix @@ -0,0 +1,276 @@ +{ + pkgs, + inputs, + config, + system, + ... +}: + +with pkgs; +let + cfg = config.schmittlauch.packages; + unstable = inputs.nixos-unstable.legacyPackages.${system}; + nur = inputs.nur.legacyPackages.${system}; + + graphicsApps = + [ + inkscape + darktable + exiftool + ] + ++ (with gimp3Plugins; [ + #fourier # broken + #lqrPlugin # broken + ]) + ++ lib.optionals pkgs.stdenv.isLinux [ + gimp3 + hugin + #luminanceHDR # FIXME, build failure + xournalpp + ] + ++ lib.optionals pkgs.stdenv.isDarwin [ + gimp + ]; + + multimediaApps = + [ + mpv + yt-dlp + ] + ++ lib.optionals pkgs.stdenv.isDarwin [ vlc-bin ] + ++ lib.optionals pkgs.stdenv.isLinux [ + vlc + amarok + clementine + kdePackages.elisa + musescore + tenacity + soundkonverter + #nur.repos.fooker.studio-link + ]; + + cliApps = + [ + coreutils + myVim + htop + tmux + httpie + rsync + ponysay + gti + tree + lsof + mosh + openssh + sshfs-fuse + sshuttle + cryfs + thefuck + gnupg + unar + lzop + p7zip + pwgen + pandoc + pdfgrep + # zig dependency breaks occasionally, stay on C version for now + ncdu_1 + dos2unix + unzip + fswatch + jq + age + lnav + spacer + + nix-output-monitor # putting this here as a plain `nix` alternative + ] + ++ lib.optionals pkgs.stdenv.isLinux [ + xclip + smbnetfs # for FUSE smb mounting + psmisc # for killall + torsocks + agrep + reptyr # re-bind running program to other tty + ]; + + nixHelpers = [ + nixpkgs-review + nixfmt-rfc-style + nix-top + statix + ]; + devTools = + [ + curl + httpie + gcc + shellcheck + mtr + ripgrep + fd + gitui + pre-commit + scriv + + # Haskell + ghc + cabal2nix + ] + ++ lib.optionals pkgs.stdenv.isLinux [ + gdb + strace + ltrace + valgrind + zeal + ]; + + pythonTools = with python3Packages; [ + python # to shadow old macOS python + ipython + uv + pip + numpy + matplotlib + jedi + jedi-language-server + black + flake8 + mypy + ]; + + games = [ + superTuxKart + #hedgewars + ]; + + desktopCommon = [ + keepassxc + ]; + + desktopLinux = [ + firefox + chromium + kdePackages.falkon + thunderbird + calibre + dino + zotero + ding + aspell + aspellDicts.de + aspellDicts.en + # for kate/KDE applications + hunspellDicts.de-de + hunspellDicts.en-us + hunspellDicts.en-gb-ise + seafile-client + alacritty + libreoffice-qt6 # still with KDE integration + anki + signal-desktop + (tor-browser-bundle-bin.override { + mediaSupport = true; + pulseaudioSupport = pkgs.stdenv.isLinux; + }) + tigervnc + pdfpc + nheko + gpxsee + subsurface + yate + # split and merge PDFs in a GUI + pdfarranger + qbittorrent + #(pkgs.pidgin-with-plugins.override { + # plugins = [ pkgs.pidginotr ];}) + + logseq + + # for Hibiscus banking software + jameica + #ToDo: which of these drivers is actually used? + geckodriver + chromedriver + ]; + + kdeTools = + [ + okteta + plasma5Packages.kdeconnect-kde + ] + ++ (with kdePackages; [ + okular + gwenview + yakuake + dolphin + spectacle + kate + kleopatra + qdirstat + ark + kwalletmanager + #ktouch # TODO: unbreak + kcharselect + konversation + krdc + skanlite + akonadiconsole + tokodon # mastodon client + networkmanager-qt + kcrash + breeze-gtk + ]); +in +{ + options.schmittlauch.packages = { + graphics = lib.mkEnableOption "Enable a common set of graphics apps"; + multimedia = lib.mkEnableOption "Enable a common set of multimedia apps"; + cli = lib.mkOption { + description = "Enable a common set of CLI tools"; + type = lib.types.bool; + default = true; + }; + nixHelpers = lib.mkEnableOption "Enable a common set of Nix helper tools"; + devTools = lib.mkEnableOption "Enable a common set of dev tools"; + pythonTools = lib.mkEnableOption "Enable a common set of python tools"; + games = lib.mkEnableOption "Enable some games"; + desktopCommon = lib.mkOption { + description = "GUI desktop applications that work cross-platform and cross-desktop"; + type = lib.types.bool; + default = true; + }; + desktopLinux = lib.mkEnableOption "Enable a common set of desktop applications"; + kde = lib.mkEnableOption "Enable a common set of KDE applications"; + }; + config = { + home.packages = lib.flatten ( + (lib.optional cfg.graphics graphicsApps) + ++ (lib.optional cfg.multimedia multimediaApps) + ++ (lib.optional cfg.cli cliApps) + ++ (lib.optional cfg.nixHelpers nixHelpers) + ++ (lib.optional cfg.devTools devTools) + ++ (lib.optional cfg.pythonTools pythonTools) + ++ (lib.optional cfg.games games) + ++ (lib.optional cfg.desktopCommon desktopCommon) + ++ (lib.optional cfg.desktopLinux desktopLinux) + ++ (lib.optional cfg.kde kdeTools) + ); + + nixpkgs.overlays = import ../overlays.nix; + nixpkgs.config = { + + permittedInsecurePackages = [ + # (temporarily) permit the usage of libolm + "olm-3.2.16" + ]; + clementine.spotify = false; + vim = { + gui = "gtk3"; + python = true; + multibyteSupport = true; + }; + }; + }; +} diff --git a/home/modules/vscodium.nix b/home/modules/vscodium.nix new file mode 100644 index 0000000..a42b7ec --- /dev/null +++ b/home/modules/vscodium.nix @@ -0,0 +1,120 @@ +{ + pkgs, + lib, + inputs, + config, + system, + ... +}: +{ + programs.vscode = { + enable = true; + package = pkgs.vscodium; + mutableExtensionsDir = true; + profiles.default = { + extensions = + with pkgs.vscode-extensions; + [ + ms-python.python + charliermarsh.ruff + vscodevim.vim + yzhang.markdown-all-in-one + bungcip.better-toml + eamodio.gitlens + jnoortheen.nix-ide + mkhl.direnv + editorconfig.editorconfig + ] + ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "Sync-Rsync"; + publisher = "vscode-ext"; + version = "0.36.0"; + sha256 = "sha256-0b/OHLZfXo0NAVAVkzZSqMGDzF0uvPRoiqsZtW1iOdA"; + } + # TODO: probably available in nixpkgs soonish? + { + name = "mypy-type-checker"; + publisher = "ms-python"; + version = "2023.3.12681020"; + sha256 = "sha256-rhed7CQlvxksVCGc9nPU2oYQWtXcAV5TzuG63e8Y3zM="; + } + { + name = "vscode-pets"; + publisher = "tonybaloney"; + version = "1.25.1"; + sha256 = "sha256-as3e2LzKBSsiGs/UGIZ06XqbLh37irDUaCzslqITEJQ="; + } + ]; + userSettings = + let + defaultPython = pkgs.python3.withPackages (ps: [ + ps.jedi + ps.jedi-language-server + ps.pip + ps.setuptools # for pkg_resources + ps.black + ps.mypy + ]); + in + { + "editor.fontLigatures" = true; + "editor.accessibilitySupport" = false; # prevent asking + "editor.cursorBlinking" = "phase"; + "editor.stickyScroll.enabled" = true; + "workbench.editor.highlightModifiedTabs" = true; + "window.autoDetectColorScheme" = true; + "workbench.preferredDarkColorTheme" = "Default Dark Modern"; + "workbench.preferredLightColorTheme" = "Default Light Modern"; + "[nix]" = { + "editor.insertSpaces" = true; + "editor.tabSize" = 2; + # for now, disable automatic formatting to prevent disruption of existing code bases + "editor.formatOnPaste" = false; + "editor.formatOnSave" = false; + "editor.formatOnType" = false; + }; + "nix.formatterPath" = lib.getExe pkgs.nixfmt-rfc-style; + "nix.enableLanguageServer" = true; + "nix.serverPath" = lib.getExe pkgs.nixd; + "nix.serverSettings" = { }; + "editor.fontSize" = 13; + "editor.fontWeight" = "normal"; + "git.detectSubmodulesLimit" = 30; + "[python]" = { + "breadcrumbs.showClasses" = true; + "breadcrumbs.showFunctions" = true; + "gitlens.codeLens.symbolScopes" = [ "!Module" ]; + "editor.defaultFormatter" = "charliermarsh.ruff"; + "editor.formatOnSave" = true; + }; + "python.experiments.enabled" = false; + "python.languageServer" = "Jedi"; # don't use proprietary pylance server + "python.defaultInterpreterPath" = "${defaultPython}/bin/python"; + "mypy-type-checker.path" = [ "${pkgs.python3Packages.mypy}/bin/mypy" ]; + "mypy-type-checker.importStrategy" = "fromEnvironment"; + "mypy-type-checker.args" = [ "--ignore-missing-imports" ]; + "ruff.path" = [ (lib.getExe pkgs.ruff) ]; + "ruff.importStrategy" = "fromEnvironment"; + "gitlens.telemetry.enabled" = false; + "vim.highlightedyank.enable" = true; + "vim.history" = 500; + "vim.neovimUseConfigFile" = true; + "vim.enableNeovim" = true; + "git.suggestSmartCommit" = false; + "editor.rulers" = [ 79 ]; + "vim.useSystemClipboard" = true; + "vim.smartRelativeLine" = true; + "diffEditor.ignoreTrimWhitespace" = false; + "files.associations" = { + "*.py" = "python"; + }; + "editor.renderWhitespace" = "all"; + "editor.fontFamily" = "Iosevka Curly Slab, Menlo, Monaco, 'Courier New', monospace"; + "vim.neovimPath" = lib.getExe pkgs.myVim; + "sync-rsync.options" = [ ]; + "direnv.path.executable" = lib.getExe pkgs.direnv; + }; + }; + }; +} diff --git a/home/overlays.nix b/home/overlays.nix index f2ae044..5a9b213 100644 --- a/home/overlays.nix +++ b/home/overlays.nix @@ -1,9 +1,9 @@ - [ - ( - self: super: - rec { - myVim = with super; neovim.override { configure = { + (self: super: rec { + myVim = + with super; + neovim.override { + configure = { packages.myVimPackage = with pkgs.vimPlugins; { # loaded on start start = [ @@ -25,8 +25,7 @@ ]; }; customRC = builtins.readFile ./vimrc; - };}; - } - ) - + }; + }; + }) ] diff --git a/home/scripts/reporsync.nix b/home/scripts/reporsync.nix new file mode 100644 index 0000000..8412c8c --- /dev/null +++ b/home/scripts/reporsync.nix @@ -0,0 +1,85 @@ +{ pkgs, lib, ... }: +'' + # rsync -rlptzv --progress --delete --exclude=.git --exclude=.vscode --exclude=result --exclude=channels/ /Users/os/src/fc.qemu os@hydra01: + # rsync -rlptzv --progress --rsh="ssh -J fcio-whq-jump" --delete --exclude=.git --exclude=.vscode --exclude=result --exclude=channels/ /Users/os/src/fc-nixos/ os@patty:fc-nixos/ + + + DEFAULT_JUMPHOST="fcio-whq-jump" + + _parse_rsync_args() { + # reset pre-defined variables that are read and manipulated throughout this function + unset JUMPHOST + # arrays are bash or zsh specific + RSYNC_OPTS=("-rlptzv" "--progress" "--delete" "--exclude=.git" "--exclude=.vscode" "--exclude=result" "--exclude=channels/" "--exclude=.mypy_cache") + + while getopts ':Jj:' OPT; do + case $OPT in + j) + if [ -n "$JUMPHOST" ]; then + echo "-j and -J are conflicting arguments" >&2 + return 1 + fi + JUMPHOST="$OPTARG" + ;; + J) + if [ -n "$JUMPHOST" ]; then + echo "-j and -J are conflicting arguments" >&2 + return 1 + fi + JUMPHOST="$DEFAULT_JUMPHOST" + ;; + ?) + echo "rsyncrepo [-J] [-j ] [target dir name]" + return 1 + ;; + esac + done + + # trim CLI parameters + shift "$(($OPTIND -1))" + + RR_FROM="$1" + RR_TO="$2" + RR_TARGET="$3" + } + + _do_rsync() { + # parameter check + if [ -z "$1" ] || [ -z "$2" ]; then + echo "Missing arguments, required: " >&2 + return 1 + fi + + if [ -n "$JUMPHOST" ]; then + RSYNC_OPTS+=("--rsh=${lib.getExe pkgs.openssh} -J ''${JUMPHOST}") + fi + + for OPTI in "''${RSYNC_OPTS[@]}"; do + echo "$OPTI" + done + + # If no $3 is specified, we sync /path/to/dir/ to hostname:dir + if [ -z "$3" ]; then + RR_DEST="''${2}:$(basename $(realpath "''${1}"))" + else + RR_DEST="''${2}:''${3}" + fi + + echo "Syncing ''${1} to ''${RR_DEST}…" + + # ensure trailing slash for src to avoid recreating directory + ${lib.getExe pkgs.rsync} "''${RSYNC_OPTS[@]}" "''${1}/" "''${RR_DEST}" + } + + rsyncrepo() { + _parse_rsync_args "$@" + # inherits parsed arguments through variables + _do_rsync "$RR_FROM" "$RR_TO" "$RR_TARGET" + } + + rsynchydra() { + _parse_rsync_args "$@" + # the name of RR_TO is a bit misleading, it just describes the 2nd positional arg here + _do_rsync "$RR_FROM" "hydra01" "$RR_TO" + } +'' diff --git a/home/scripts/ssh-loop-fc.nix b/home/scripts/ssh-loop-fc.nix new file mode 100644 index 0000000..a632477 --- /dev/null +++ b/home/scripts/ssh-loop-fc.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +'' + ssh-loop () { + setopt shwordsplit + local hosts=$1 + local cmd=$2 + + for x in $1; do echo $x; ${pkgs.openssh}/bin/ssh $x.fcio.net -o StrictHostKeyChecking=no -C "$2"; done + } + + ssh-loop-parallel () { + setopt shwordsplit + local hosts=$1 + local cmd=$2 + + for x in $1; do echo $x; ${pkgs.openssh}/bin/ssh $x.fcio.net -o StrictHostKeyChecking=no -C "$2" 2>&1 | sed -e "s/^/$x: /;" & done + wait + } +'' diff --git a/home/secrets b/home/secrets index 068a475..c725f81 160000 --- a/home/secrets +++ b/home/secrets @@ -1 +1 @@ -Subproject commit 068a4759e72948284c3de85d20a780723278f8b8 +Subproject commit c725f810bb9a43c213fcf964f036dd0c64b6ba04 diff --git a/home/vimrc b/home/vimrc index 106ee8c..05ea804 100644 --- a/home/vimrc +++ b/home/vimrc @@ -24,7 +24,11 @@ filetype plugin indent on syntax on +" use relative numbering… +set relativenumber +" except for current line set number + set mouse=a set mousehide @@ -42,24 +46,29 @@ set history=1000 " representing system clipboard (not X11 clipboard) set clipboard=unnamedplus -" set expandtab +set expandtab set shiftwidth=4 set tabstop=4 set softtabstop=4 " enable truecolor support -"let &t_8f = "\[38;2;%lu;%lu;%lum" -"let &t_8b = "\[48;2;%lu;%lu;%lum" -"set termguicolors -" -"let base16colorspace=256 +let &t_8f = "\[38;2;%lu;%lu;%lum" +let &t_8b = "\[48;2;%lu;%lu;%lum" +set termguicolors -"colorscheme base16-tomorrow-night +let base16colorspace=256 + +colorscheme base16-tomorrow-night "colorscheme Tomorrow-Night "colorscheme base16-default-dark set background=dark +" use default terminal background to retain transparency +highlight Normal guibg=NONE +highlight NonText guibg=NONE +highlight SignColumn guibg=NONE + " Use the same symbols as TextMate for tabstops and EOLs set listchars=tab:▸\ ,eol:¬ @@ -97,6 +106,7 @@ let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static` let g:haskell_backpack = 1 " to enable highlighting of backpack keywords au FileType markdown setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4 +au FileType pandoc setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4 au FileType nix setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2 set ofu=syntaxcomplete#Complete " nmap "+gP diff --git a/home/workmac.nix b/home/workmac.nix new file mode 100644 index 0000000..5227db0 --- /dev/null +++ b/home/workmac.nix @@ -0,0 +1,119 @@ +{ + pkgs, + inputs, + config, + system, + lib, + ... +}: + +with pkgs; +let + unstable = inputs.nixos-unstable.legacyPackages.${system}; +in +{ + + schmittlauch.packages = { + graphics = true; + multimedia = true; + nixHelpers = true; + devTools = true; + pythonTools = true; + }; + + home.packages = [ + wireshark # on NixOS systems enabled via system config + _1password-cli + # also TODO: color schemes nix-darwin + ]; + + # pinning theme is necessary until iTerm 3.5, because despite the dark terminal background, bat detects light mode and adapts theme + programs.bat.config.theme = "Visual Studio Dark+"; + + programs.ssh = { + enable = true; + # defaults in bottom match block "*" + # TODO: common config for desktop as well + # multiplexer, e.g. to avoid rate limiting on jumphost usage + serverAliveInterval = 60; + controlMaster = "auto"; + controlPersist = "4h"; + # ssh host config + matchBlocks = { + + # early catchall to enforce agent socket usage. **NOT** the place for fallback defaults. + "*" = { + extraOptions = { + IdentityAgent = "\"~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock\""; + #ControlPath = "/tmp/ssh_mux_%h_%p_%r"; + }; + }; + + "hydra01" = lib.hm.dag.entryAfter [ "*" ] { + hostname = "hydra01.access.whq.gocept.net"; + user = "os"; + }; + "fcio-whq-jump" = lib.hm.dag.entryAfter [ "*" ] { + hostname = "vpn-whq.services.fcio.net"; + extraOptions.LogLevel = "Verbose"; + }; + "fcio-rzob-jump" = lib.hm.dag.entryAfter [ "*" ] { hostname = "vpn-rzob.services.fcio.net"; }; + }; + }; + + programs.git = + let + contacts = import "${inputs.mysecrets}/contacts.nix" { inherit lib; }; + in + { + includes = + [ + { + condition = "gitdir:~/src/schmittlauch/"; + contents = { + user = { + inherit (contacts.schmittlauch) name email; + }; + }; + } + ] + # set default name for several other common locations + ++ map (dir: { + condition = "gitdir:${dir}"; + contents = { + user = { + inherit (contacts.work) name email; + }; + }; + }) [ "~/" ]; + }; + + # some extra shell scripts + programs.zsh.initContent = lib.mkAfter ( + import ./scripts/reporsync.nix { inherit pkgs lib; } + + import ./scripts/ssh-loop-fc.nix { inherit pkgs lib; } + ); + + launchd.agents.hydra_proxy = { + enable = true; + config = { + ProgramArguments = [ + "${lib.getExe pkgs.autossh}" + "-M" + "0" + "-D" + "1080" + "-oServerAliveInterval=60" + "-oControlMaster=no" + "-N" + "vpn-whq.services.fcio.net" + ]; + # TODO: consider socket activation instead + KeepAlive = true; + ThrottleInterval = 60; + }; + }; + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "1password-cli" ]; + + home.stateVersion = "22.05"; +} diff --git a/hosts/framenix/default.nix b/hosts/framenix/default.nix new file mode 100644 index 0000000..f1e62cd --- /dev/null +++ b/hosts/framenix/default.nix @@ -0,0 +1,79 @@ +{ + config, + lib, + pkgs, + system, + ... +}: +let + unstable = config.inputInjection.flake-inputs.nixos-unstable.legacyPackages.${system}; +in +{ + imports = [ + ../../common + ../../common/pipewire.nix + + ./hardware-configuration.nix + ./storage.nix + ./swap.nix + ]; + + networking.hostName = "framenix"; # Define your hostname. + + # override tmpdir for daemon + systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp"; + + boot.kernelParams = [ + # powersave + "amd_pstate=active" + "amdgpu.abmlevel=1" # adaptive backlight management + ]; + + boot.initrd.systemd.enable = true; + + # at boot by default, limit charging capacity to protect battery. + # Hopefully there's gonna be a standard interface to control this from the desktop at some point. + systemd.services.battery-charge-limit = { + wantedBy = [ "basic.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${lib.getExe pkgs.framework-tool} --driver portio --charge-limit 85"; + RemainAfterExit = true; + }; + }; + + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "23.11"; # Did you read the comment? + + hardware.enableRedistributableFirmware = true; + + services.fwupd.enable = true; + + # I do not need fingerprint reading + services.fprintd.enable = false; + + environment.systemPackages = [ + pkgs.radeontop + pkgs.framework-tool + ]; +} diff --git a/hosts/framenix/hardware-configuration.nix b/hosts/framenix/hardware-configuration.nix new file mode 100644 index 0000000..b9295b2 --- /dev/null +++ b/hosts/framenix/hardware-configuration.nix @@ -0,0 +1,35 @@ +# 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 = [ + "nvme" + "xhci_pci" + "thunderbolt" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp193s0f3u1c2.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/framenix/internal_display_profile_xrite-i1pro2.icm b/hosts/framenix/internal_display_profile_xrite-i1pro2.icm new file mode 100644 index 0000000..e067230 Binary files /dev/null and b/hosts/framenix/internal_display_profile_xrite-i1pro2.icm differ diff --git a/hosts/framenix/storage.nix b/hosts/framenix/storage.nix new file mode 100644 index 0000000..7fb2801 --- /dev/null +++ b/hosts/framenix/storage.nix @@ -0,0 +1,54 @@ +{ + config, + lib, + pkgs, + ... +}: +let + fsOptions = [ + "noatime" + "ssd" + "compress=zstd" + ]; +in +{ + boot.initrd.luks = { + devices = + # allow discards on all devices + builtins.mapAttrs (name: val: val // { allowDiscards = true; }) { + "system".device = "/dev/disk/by-uuid/1838cdc5-9b0b-4c46-9f23-9465549eeb92"; + "cryptswap".device = "/dev/disk/by-uuid/ded7d649-ab3a-42ee-ae4a-f8c4ba029e9c"; + }; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/22388786-4285-403b-9994-e9aae1f11172"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=nixos_root" ]; + }; + + "/home" = { + device = "/dev/disk/by-uuid/22388786-4285-403b-9994-e9aae1f11172"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=home" ]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/AF8E-E9E6"; + fsType = "vfat"; + options = [ "discard" ]; + }; + }; + + services.fstrim.enable = true; + services.btrfs.autoScrub = { + enable = true; + fileSystems = [ + "/" + "/home" + ]; + }; + + boot.tmp.useTmpfs = true; +} diff --git a/hosts/framenix/swap.nix b/hosts/framenix/swap.nix new file mode 100644 index 0000000..ce2347e --- /dev/null +++ b/hosts/framenix/swap.nix @@ -0,0 +1,10 @@ +{ + swapDevices = [ { device = "/dev/disk/by-uuid/24c47f3d-0d3e-4575-92a2-174b5a6b6086"; } ]; + + zramSwap = { + enable = true; + memoryPercent = 20; + }; + + boot.kernel.sysctl."vm.swappiness" = 9; +} diff --git a/hosts/thinknix/default.nix b/hosts/thinknix/default.nix new file mode 100644 index 0000000..431f3ba --- /dev/null +++ b/hosts/thinknix/default.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + imports = [ + ../../common + ../../common/pulseaudio.nix + + ./hardware-configuration.nix + ./storage.nix + ./swap.nix + # FIXME: move this to common, conditional enabling + ./secureboot.nix + ]; + + hardware.trackpoint = { + enable = true; + sensitivity = 180; + speed = 180; + }; + + boot.extraModprobeConfig = "options thinkpad_acpi fan_control=1"; # enable fan control via echo to /proc/acpi/ibm/fan + + schmittlauch.guestUser.enable = true; + + networking.hostName = "thinknix"; + + # This value determines the NixOS release with which your system is to be + # compatible, in order to avoid breaking some software such as database + # servers. You should change this only after NixOS release notes say you + # should. + system.stateVersion = "18.09"; # Did you read the comment? +} diff --git a/hosts/thinknix/hardware-configuration.nix b/hosts/thinknix/hardware-configuration.nix new file mode 100644 index 0000000..74708b5 --- /dev/null +++ b/hosts/thinknix/hardware-configuration.nix @@ -0,0 +1,27 @@ +{ + config, + lib, + pkgs, + modulesPath, + ... +}: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ehci_pci" + "ahci" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + nix.settings.max-jobs = lib.mkDefault 4; + + # modesetting is always better than intel (legacy) + services.xserver.videoDrivers = [ "modesetting" ]; +} diff --git a/hosts/thinknix/secureboot.nix b/hosts/thinknix/secureboot.nix new file mode 100644 index 0000000..657838e --- /dev/null +++ b/hosts/thinknix/secureboot.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + boot.loader.efi.canTouchEfiVariables = true; + + # UEFI secure boot + environment.systemPackages = [ pkgs.sbctl ]; + # Lanzaboote currently replaces the systemd-boot module. + # This setting is usually set to true in configuration.nix + # generated at installation time. So we force it to false + # for now. + boot.loader.systemd-boot.enable = lib.mkForce false; + + boot.lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; +} diff --git a/hosts/thinknix/storage.nix b/hosts/thinknix/storage.nix new file mode 100644 index 0000000..169cca6 --- /dev/null +++ b/hosts/thinknix/storage.nix @@ -0,0 +1,85 @@ +{ + config, + lib, + pkgs, + ... +}: +let + fsOptions = [ + "noatime" + "ssd" + "space_cache" + "compress=zstd" + ]; +in +{ + # encrypted partitions + boot.initrd.luks = { + devices = + # allow discards on all devices + builtins.mapAttrs (name: val: val // { allowDiscards = true; }) { + "system".device = "/dev/disk/by-uuid/85154131-b2a8-4ef5-9d74-47429cb267ef"; + "cryptswap".device = "/dev/disk/by-uuid/ac586df6-6332-4809-beb1-f51906a2adaa"; + "ssd2".device = "/dev/disk/by-uuid/cadd4e1f-3642-4faa-8d4e-37dd85465df1"; + }; + reusePassphrases = true; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/cb5998ae-cfc9-447f-8756-1ceaec6ca4c4"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=nixos_root" ]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/DED9-661B"; + fsType = "vfat"; + options = [ "discard" ]; + }; + + "/home" = { + device = "/dev/disk/by-uuid/cb5998ae-cfc9-447f-8756-1ceaec6ca4c4"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=home" ]; + }; + + "/var/tmp" = { + device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=vartmp" ]; + }; + + "/var/log" = { + device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=varlog" ]; + }; + + "/var/cache" = { + device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15"; + fsType = "btrfs"; + options = fsOptions ++ [ "subvol=varcache" ]; + }; + }; + + services.fstrim.enable = true; + services.btrfs.autoScrub = { + enable = true; + fileSystems = [ + "/" + "/home" + ]; + }; + + boot.tmp.useTmpfs = true; + fileSystems."/tmp".fsType = "tmpfs"; + + services.smartd = { + enable = true; + devices = [ + { device = "/dev/sda"; } + { device = "/dev/sdb"; } + ]; + }; +} diff --git a/hosts/thinknix/swap.nix b/hosts/thinknix/swap.nix new file mode 100644 index 0000000..d600057 --- /dev/null +++ b/hosts/thinknix/swap.nix @@ -0,0 +1,10 @@ +{ + swapDevices = [ { device = "/dev/disk/by-uuid/bf928178-4e92-4e7e-8df2-18fbd658eecf"; } ]; + + zramSwap = { + enable = true; + memoryPercent = 20; + }; + + boot.kernel.sysctl."vm.swappiness" = 9; +} diff --git a/nixos/Hash2PubTestbed.nix b/nixos/Hash2PubTestbed.nix index 1efbfe6..99c4cac 100644 --- a/nixos/Hash2PubTestbed.nix +++ b/nixos/Hash2PubTestbed.nix @@ -1,10 +1,15 @@ -{ config, pkgs, experimentUid ? 1000, ... }: +{ + config, + pkgs, + experimentUid ? 1000, + ... +}: let projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW"; projectPath = builtins.toPath projectDir; projectMount = "/mnt/project"; - shell = (import (projectDir + "/Hash2Pub/default.nix") {}).shell; + shell = (import (projectDir + "/Hash2Pub/default.nix") { }).shell; simulationSetupScript = pkgs.writeShellScriptBin "simulationSetup" '' # make cabal-install work offline mkdir $HOME/.cabal @@ -12,25 +17,30 @@ let # run simulation script within the shell ${pkgs.nix}/bin/nix-shell ${shell.drvPath} --command "cd ${projectMount} && bash ./build/simulationrunner.sh 2>&1" - ''; - instanceData = builtins.fromJSON (builtins.readFile "${projectDir}/simulationData/inputs/generated/instances_sample.json"); - + ''; + instanceData = builtins.fromJSON ( + builtins.readFile "${projectDir}/simulationData/inputs/generated/instances_sample.json" + ); in { privateNetwork = true; ephemeral = true; bindMounts = { - "${projectMount}" = { hostPath = projectDir; isReadOnly = false; }; + "${projectMount}" = { + hostPath = projectDir; + isReadOnly = false; + }; }; config = { networking = { firewall.enable = false; - interfaces.lo.ipv6.addresses = - builtins.map (inst: {address = inst.ip; prefixLength = 0;}) instanceData; - extraHosts = - pkgs.lib.concatMapStringsSep "\n" (inst: "${inst.ip} ${inst.hostname}") instanceData; + interfaces.lo.ipv6.addresses = builtins.map (inst: { + address = inst.ip; + prefixLength = 0; + }) instanceData; + extraHosts = pkgs.lib.concatMapStringsSep "\n" (inst: "${inst.ip} ${inst.hostname}") instanceData; }; # avoid permission problems with project builds users.users.experimentor = { @@ -39,12 +49,14 @@ in }; # adjust open file limits - security.pam.loginLimits = [{ - domain = "*" - ; type = "-" - ; item = "nofile" - ; value = "50000" - ;}]; + security.pam.loginLimits = [ + { + domain = "*"; + type = "-"; + item = "nofile"; + value = "50000"; + } + ]; environment.systemPackages = [ pkgs.netcat @@ -55,7 +67,7 @@ in pkgs.iftop (pkgs.writeShellScriptBin "doSimulation" '' su experimentor -c "${simulationSetupScript}/bin/simulationSetup" - '') + '') pkgs.tcpdump ]; }; diff --git a/nixos/configuration.nix b/nixos/configuration.nix deleted file mode 100644 index df6224e..0000000 --- a/nixos/configuration.nix +++ /dev/null @@ -1,296 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, lib, inputs, ... }: - -let - unstable = inputs.nixos-unstable; - localfork = import /home/spiollinux/src/nixpkgs { }; - -in -{ - imports = - [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ./packages.nix - ]; - - services.davfs2.enable = true; - - # try newer kernels - boot.kernelPackages = pkgs.linuxPackages_latest; - - # use old kernel because 5.4 and 5.5 might be buggy with intel graphics - #boot.kernelPackages = pkgs.linuxPackages_4_19; - - services.fstrim.enable = true; - services.btrfs.autoScrub = - { - enable = true; - fileSystems = [ "/" "/home" ]; - }; - - # exfat support - #boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; - - zramSwap = - { - enable = true; - memoryPercent = 20; - }; - boot.kernel.sysctl."vm.swappiness" = 9; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # make the boot look good - boot.plymouth.enable = true; - - networking.hostName = "thinknix"; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # configure console - console = { - font = "Lat2-Terminus16"; - keyMap = "de"; - }; - - # Select internationalisation properties. - i18n = { - defaultLocale = "de_DE.UTF-8"; - }; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - programs.bash.enableCompletion = true; - programs.wireshark = - { - enable = true; - package = pkgs.wireshark; - }; - - programs.adb.enable = true; - - # programs.mtr.enable = true; - # programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - #programs.ssh.startAgent = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - networking.firewall.allowedTCPPortRanges = [{ from = 1714; to = 1764; }]; - networking.firewall.allowedUDPPortRanges = [{ from = 1714; to = 1764; }]; # for KDE connect - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - networking.networkmanager.enable = true; - - services.avahi.enable = true; - - # Enable CUPS to print documents. - services.printing = - { - enable = true; - drivers = [ pkgs.hplip ]; - }; - # scanners - hardware.sane = - { - enable = true; - extraBackends = [ pkgs.hplip ]; - }; - - # Enable sound. - sound.enable = true; - hardware.pulseaudio = { - enable = true; - # decouple pulseaudio application and sink volumes - daemon.config = { flat-volumes = "no"; }; - # C3D2 hq music - zeroconf.discovery.enable = true; - zeroconf.publish.enable = true; - }; - - - # Bluetooth - hardware.bluetooth = { - enable = true; - settings.General.Disable = "Headset"; # disable headset profile - }; - hardware.pulseaudio = { - package = pkgs.pulseaudioFull; - }; - - # Nitrokey support - services.udev.packages = [ pkgs.nitrokey-udev-rules ]; - - # Enable the X11 windowing system. - services.xserver.enable = true; - services.xserver.layout = "de"; - services.xserver.xkbOptions = "eurosign:e"; - - # Enable touchpad support. - services.xserver.libinput.enable = true; - - # while libinput also supports graphic tablets, enable more-specific wacom driver - services.xserver.wacom.enable = true; - - # Enable the KDE Desktop Environment. - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5.enable = true; - - # dconf required for several Gnome applications like Cawbird - programs.dconf.enable = true; - - # Flatpak support - services.flatpak.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ]; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.spiollinux = { - isNormalUser = true; - uid = 1000; - extraGroups = [ "vboxusers" "wheel" "networkmanager" "scanner" "lp" "wireshark" "dialout" "cdrom" "input" "adbusers" ]; - shell = pkgs.zsh; - }; - - # enable virtualbox support - virtualisation.virtualbox.host = { - enable = true; - #enableExtensionPack = true; - }; - # allow PUEL license - nixpkgs.config.whitelistedLicenses = [ pkgs.lib.licenses.virtualbox-puel ]; - users.extraGroups.vboxusers.members = [ "spiollinux" ]; - - programs.zsh = - { - enable = true; - autosuggestions.enable = true; - }; - - # profile sync daemon - services.psd.enable = true; - - services.smartd = - { - enable = true; - devices = [{ device = "/dev/sda"; } { device = "/dev/sdb"; }]; - }; - - # block certain sites to prevent procrastination - systemd.services.procrastinationstop = { - serviceConfig.Type = "oneshot"; - wantedBy = [ ]; - script = '' - ln -sf ${pkgs.writeText "blockedHosts" '' - 127.0.0.1 localhost - ::1 localhost - 127.0.0.2 ${config.networking.hostName} - ::1 ${config.networking.hostName} - - ::1 twitter.com - 127.0.0.1 twitter.com - ::1 api.twitter.com - 127.0.0.1 api.twitter.com - ::1 toot.matereal.eu - 127.0.0.1 toot.matereal.eu - ::1 tagesschau.de - 127.0.0.1 tagesschau.de - ::1 dnn.de - 127.0.0.1 www.dnn.de - ::1 www.dnn.de - 127.0.0.1 dnn.de - ''} /etc/hosts - ''; - }; - - systemd.services.procrastinationstart = { - serviceConfig.Type = "oneshot"; - wantedBy = [ ]; - script = '' - ln -sf /etc/static/hosts /etc/hosts - ''; - }; - - fonts = { - fontDir.enable = true; - fontconfig.enable = true; - fontconfig.includeUserConf = true; - }; - - # Enable all sysrq functions (useful to recover from some issues): - boot.kernel.sysctl."kernel.sysrq" = 1; # NixOS default: 16 (only the sync command) - - nix = { - # expose all flake inputs through nix Path and registry - registry = (lib.mapAttrs (_: value: { flake = value; }) inputs) // { - nixpkgs.flake = inputs.nixpkgs; - }; - nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - # keep build-time deps around for offline-rebuilding - settings = { - # keep around all inputs necessary for offline-rebuilding the system - keep-outputs = true; - keep-derivations = true; - trusted-users = [ "spiollinux" ]; - experimental-features = [ "nix-command" "flakes" ]; - # use all cores for building - cores = 0; - }; - }; - # override tmpdir for daemon - #systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp"; - - # remote builders - #nix.buildMachines = [ - # { - # hostName = "build01.nix-community.org"; - # sshUser = "ssh-ng://schmittlauch"; - # sshKey = "/root/.ssh/remote_builder_key"; - # system = "x86_64-linux"; - # maxJobs = 64; - # supportedFeatures = [ - # "big-parallel" - # "kvm" - # "nixos-test" - # ]; - # } - #]; - programs.ssh.knownHosts."build01.nix-community.org".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIElIQ54qAy7Dh63rBudYKdbzJHrrbrrMXLYl7Pkmk88H"; - - # package debugging - # programs.sysdig.enable = true; - - # declarative containers - containers = { - # hash2PubSim = import ./Hash2PubTestbed.nix - # { - # inherit pkgs config; - # experimentUid = config.users.users.spiollinux.uid; - # projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW"; - # }; - }; - - # stop NetworkManager from managing virtual interfaces - networking.networkmanager.unmanaged = [ "interface-name:ve-*" ]; - - # This value determines the NixOS release with which your system is to be - # compatible, in order to avoid breaking some software such as database - # servers. You should change this only after NixOS release notes say you - # should. - system.stateVersion = "18.09"; # Did you read the comment? - -} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix deleted file mode 100644 index 4c1b5c1..0000000 --- a/nixos/hardware-configuration.nix +++ /dev/null @@ -1,95 +0,0 @@ -{ config, lib, pkgs, modulesPath, inputs, ... }: - - -let - fsOptions = [ "noatime" "ssd" "space_cache" "compress=zstd" ]; -in -{ - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - (inputs.nixos-hardware + "/lenovo/thinkpad/t440s") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = []; - - # encrypted partitions - boot.initrd.luks = - { - devices = - # allow discards on all devices - builtins.mapAttrs (name: val: val // {allowDiscards = true;}) - { - "system".device = "/dev/disk/by-uuid/85154131-b2a8-4ef5-9d74-47429cb267ef"; - "cryptswap".device = "/dev/disk/by-uuid/ac586df6-6332-4809-beb1-f51906a2adaa"; - "ssd2".device = "/dev/disk/by-uuid/cadd4e1f-3642-4faa-8d4e-37dd85465df1"; - }; - reusePassphrases = true; - }; - - fileSystems."/" = - { - device = "/dev/disk/by-uuid/cb5998ae-cfc9-447f-8756-1ceaec6ca4c4"; - fsType = "btrfs"; - options = fsOptions ++ [ "subvol=nixos_root" ]; - }; - - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/DED9-661B"; - fsType = "vfat"; - options = [ "discard" ]; - }; - - fileSystems."/home" = - { - device = "/dev/disk/by-uuid/cb5998ae-cfc9-447f-8756-1ceaec6ca4c4"; - fsType = "btrfs"; - options = fsOptions ++ [ "subvol=home" ]; - }; - - fileSystems."/var/tmp" = - { - device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15"; - fsType = "btrfs"; - options = fsOptions ++ [ "subvol=vartmp" ]; - }; - - fileSystems."/var/log" = - { - device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15"; - fsType = "btrfs"; - options = fsOptions ++ [ "subvol=varlog" ]; - }; - - fileSystems."/var/cache" = - { - device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15"; - fsType = "btrfs"; - options = fsOptions ++ [ "subvol=varcache" ]; - }; - - boot.tmpOnTmpfs = true; - fileSystems."/tmp".fsType = "tmpfs"; - - swapDevices = - [ - { device = "/dev/disk/by-uuid/bf928178-4e92-4e7e-8df2-18fbd658eecf"; } - ]; - - nix.settings.max-jobs = lib.mkDefault 4; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - - hardware.trackpoint = { - enable = true; - sensitivity = 180; - speed = 180; - }; - - - # modesetting is always better than intel (legacy) - services.xserver.videoDrivers = [ "modesetting" ]; - -} diff --git a/nixos/packages.nix b/nixos/packages.nix deleted file mode 100644 index be11975..0000000 --- a/nixos/packages.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ pkgs, config, ... }: - -{ - # List packages installed in system profile. - environment.systemPackages = with pkgs; [ - wget - vim - vimPlugins.vim-nix - vimPlugins.pathogen - tmux - htop - zsh - btrfs-progs - git - python3 - man-pages - dnsutils - netcat - ntfs3g - file - multipath-tools - strace - ltrace - valgrind - testdisk - rsync - pv - exfat - iotop - cifs-utils - dstat - lsof - macchanger - borgbackup - - # for debugging WLAN failures: - ethtool - trace-cmd - - # NetworkManager stuff - networkmanager-openconnect - networkmanager-vpnc - networkmanager-openvpn - plasma5Packages.kdeGear.akonadi-mime # for KOrganizer - ] - ++ (with plasma5Packages; with kdeGear; [ - #akonadi - #akonadi-calendar - #akonadi-contacts - #akonadi-import-wizard - #akonadi-mime - #akonadi-notes - #akonadi-search - #akonadiconsole - #akregator - #kaddressbook - #kalarm - #kalarmcal - #kcalutils - #kcontacts - #kdav - #kdepim-addons - - #kdepim-runtime - #kidentitymanagement - #kldap - #kmail - #kmailtransport - #kmbox - #kmime - #kontact - #kontactinterface - #korganizer - #kpimtextedit - #libkdepim - #libksieve - #mailcommon - #messagelib - #pimcommon - #pim-sieve-editor - - # for some Flatpak packkages - accountsservice - ]); -} - - diff --git a/nixremotebuildermachines b/nixremotebuildermachines new file mode 100644 index 0000000..82800d1 --- /dev/null +++ b/nixremotebuildermachines @@ -0,0 +1 @@ +ssh-ng://schmittlauch@build01.nix-community.org x86_64-linux /root/.ssh/remote_builder_key 64 1 big-parallel,kvm,nixos-test - diff --git a/packages/default.nix b/packages/default.nix new file mode 100644 index 0000000..fe84da9 --- /dev/null +++ b/packages/default.nix @@ -0,0 +1,8 @@ +final: prev: { + python3 = prev.python3.override { + packageOverrides = python-final: python-prev: { + # spsdk tests fail with timeout on old laptop thinknix + spsdk = python-prev.spsdk.overridePythonAttrs { doCheck = false; }; + }; + }; +} diff --git a/patches/keepassxc-fix-darwin-build.patch b/patches/keepassxc-fix-darwin-build.patch new file mode 100644 index 0000000..3684a24 --- /dev/null +++ b/patches/keepassxc-fix-darwin-build.patch @@ -0,0 +1,26 @@ +From 49b7ae226cedb0adb403758e0c63d09762297a22 Mon Sep 17 00:00:00 2001 +From: Fernando Rodrigues +Date: Wed, 28 May 2025 14:06:23 -0300 +Subject: [PATCH] keepassxc: remove unecessary dependency + +KIO no longer seems necessary for KeePassXC, so removing it should +decrease the closure size significantly. + +Reported-by: chopper2000uk <> +Signed-off-by: Fernando Rodrigues +--- + pkgs/by-name/ke/keepassxc/package.nix | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/pkgs/by-name/ke/keepassxc/package.nix b/pkgs/by-name/ke/keepassxc/package.nix +index 170cc7bfe8e384..40b6dc15170f5b 100644 +--- a/pkgs/by-name/ke/keepassxc/package.nix ++++ b/pkgs/by-name/ke/keepassxc/package.nix +@@ -142,7 +142,6 @@ stdenv.mkDerivation (finalAttrs: { + libXi + libXtst + libargon2 +- libsForQt5.kio + libsForQt5.qtbase + libsForQt5.qtsvg + minizip