├── README.md ├── .gitignore ├── machines ├── nixpire │ ├── default.nix │ ├── rt.nix │ ├── extraGrub.nix │ └── machine.nix ├── compnix │ ├── default.nix │ ├── remote_i3.nix │ └── machine.nix ├── borknix │ ├── rt.nix │ ├── default.nix │ ├── nonRT.nix │ ├── machine.nix.home.network │ └── machine.nix ├── thinknix │ ├── rt.nix │ ├── default.nix │ └── machine.nix ├── pronix │ ├── hardware-configuration.nix │ └── configuration.nix ├── mixos │ ├── default.nix │ └── machine.nix ├── nix14 │ ├── rt.nix │ ├── default.nix │ └── machine.nix └── nixframe │ ├── rt.nix │ ├── hardware-configuration.nix │ ├── default.nix │ └── machine.nix ├── commonRT.nix ├── commonNonRT.nix ├── treefmt.toml ├── synaptics.nix ├── flake.nix ├── music.nix ├── flake.lock ├── LICENSE ├── vim.nix └── common.nix /README.md: -------------------------------------------------------------------------------- 1 | nixosConfig 2 | =========== 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | tags 3 | *.swp 4 | *.~undo-tree~ 5 | hosts* 6 | -------------------------------------------------------------------------------- /machines/nixpire/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | { 3 | imports = 4 | [ 5 | 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # music tweaks and progs: 11 | #../../music.nix 12 | ]; 13 | 14 | networking.hostName = "nixpire"; 15 | } 16 | -------------------------------------------------------------------------------- /machines/compnix/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | { 3 | imports = 4 | [ 5 | 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # music tweaks and progs: 11 | ../../music.nix 12 | ]; 13 | 14 | networking.hostName = "compnix"; 15 | 16 | musnix = { 17 | enable = true; 18 | kernel.packages = pkgs.linuxPackages_latest_rt; 19 | kernel.optimize = true; 20 | kernel.realtime = true; 21 | rtirq.nameList = "rtc0 usb"; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /machines/borknix/rt.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | { 3 | imports = 4 | [ 5 | 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # music tweaks and progs: 11 | ../../music.nix 12 | ]; 13 | 14 | networking.hostName = "borknix-rt"; 15 | 16 | musnix = { 17 | /*soundcardPciId = "00:1b.0";*/ 18 | /*rtirq.nameList = "rtc0 hpet snd snd_hda_intel";*/ 19 | soundcardPciId = "00:1b.0"; 20 | rtirq.nameList = "rtc0 hpet snd snd_hda_intel"; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /machines/nixpire/rt.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | { 3 | imports = 4 | [ 5 | 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # music tweaks and progs: 11 | ../../music.nix 12 | ]; 13 | 14 | hostName = "nixpire-rt"; 15 | 16 | 17 | musnix = { 18 | enable = true; 19 | kernel.packages = pkgs.linuxPackages_latest_rt; 20 | kernel.optimize = true; 21 | kernel.realtime = true; 22 | soundcardPciId = "00:1b.0"; 23 | rtirq.nameList = "rtc0 hpet snd snd_hda_intel"; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /machines/borknix/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | { 3 | imports = 4 | [ 5 | 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # music tweaks and progs: 11 | ../../music.nix 12 | ]; 13 | 14 | networking.hostName = "borknix"; 15 | 16 | #for running alsa trough jack 17 | boot.kernelModules = [ "snd-aloop" ]; 18 | #sound.enableMediaKeys = true; 19 | 20 | musnix = { 21 | enable = true; 22 | # kernel.optimize = true; 23 | # kernel.realtime = true; 24 | rtirq.nameList = "rtc0 23"; 25 | rtirq.nonThreaded = "rtc0 23"; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /machines/thinknix/rt.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; { 3 | imports = [ 4 | 5 | # machine specific: 6 | ./machine.nix 7 | # on every machine: 8 | ../../common.nix 9 | # on every RT machine: 10 | ../../commonRT.nix 11 | # music tweaks and progs: 12 | ../../music.nix 13 | ]; 14 | 15 | networking.hostName = "thinknix-rt"; 16 | musnix.rtirq.nameList = "rtc0 usb"; 17 | 18 | # nixos-rebuild test -p rt -I nixos-config=/home/bart/nixosConfig/machines/thinknix/rt.nix -I nixpkgs=$NIXPKGS 19 | # nixos-rebuild switch -p rt -I nixos-config=/home/bart/nixosConfig/machines/thinknix/rt.nix -I nixpkgs=$NIXPKGS 20 | 21 | 22 | # per device: 23 | services.jack.jackd.extraOptions = [ 24 | # "-v" "-P71" "-p1024" "-dalsa" "-dhw:PCH" "-r48000" "-p2048" "-n2" "-P" 25 | "-P71" 26 | "-p2048" 27 | "-dalsa" 28 | "-dhw:USB" 29 | "-r48000" 30 | "-p4096" 31 | "-n3" 32 | ]; 33 | } 34 | -------------------------------------------------------------------------------- /machines/borknix/nonRT.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | { 3 | imports = 4 | [ 5 | 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # music tweaks and progs: 11 | ../../music.nix 12 | ]; 13 | 14 | networking.hostName = "borknix"; 15 | 16 | #for running alsa trough jack 17 | boot.kernelModules = [ "snd-aloop" ]; 18 | #sound.enableMediaKeys = true; 19 | 20 | # save battery when not RT: 21 | services.tlp.enable = true; 22 | 23 | musnix = { 24 | enable = false; 25 | kernel.optimize = true; 26 | kernel.realtime = true; 27 | /*kernel.packages = pkgs.linuxPackages_4_1_rt;*/ 28 | /*kernel.latencytop = true;*/ 29 | #soundcardPciId = "00:1d.7"; 30 | rtirq.nameList = "rtc0 23"; 31 | rtirq.nonThreaded = "rtc0 23"; 32 | /*rtirq.nameList = "rtc0 usb";*/ 33 | /*rtirq.nameList = "rtc0 hpet usb";*/ 34 | /*rtirq.nameList = "rtc0 hpet snd snd_hda_intel";*/ 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /machines/nixpire/extraGrub.nix: -------------------------------------------------------------------------------- 1 | '' 2 | menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-rt-686-pae' --class debian --class gnu-linux --class gnu --class os { 3 | load_video 4 | insmod gzio 5 | insmod part_msdos 6 | insmod ext2 7 | set root='(hd0,msdos1)' 8 | search --no-floppy --fs-uuid --set=root 6a2a2731-147e-49f9-866f-70cbf61d234c 9 | echo 'Loading Linux 3.2.0-4-rt-686-pae ...' 10 | linux /boot/vmlinuz-3.2.0-4-rt-686-pae root=UUID=6a2a2731-147e-49f9-866f-70cbf61d234c ro quiet 11 | echo 'Loading initial ramdisk ...' 12 | initrd /boot/initrd.img-3.2.0-4-rt-686-pae 13 | } 14 | menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-rt-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os { 15 | load_video 16 | insmod gzio 17 | insmod part_msdos 18 | insmod ext2 19 | set root='(hd0,msdos1)' 20 | search --no-floppy --fs-uuid --set=root 6a2a2731-147e-49f9-866f-70cbf61d234c 21 | echo 'Loading Linux 3.2.0-4-rt-686-pae ...' 22 | linux /boot/vmlinuz-3.2.0-4-rt-686-pae root=UUID=6a2a2731-147e-49f9-866f-70cbf61d234c ro single 23 | echo 'Loading initial ramdisk ...' 24 | initrd /boot/initrd.img-3.2.0-4-rt-686-pae 25 | } 26 | '' 27 | -------------------------------------------------------------------------------- /machines/pronix/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ 9 | (modulesPath + "/installer/scan/not-detected.nix") 10 | ]; 11 | 12 | boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "uhci_hcd" "mpt3sas" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; 13 | boot.initrd.kernelModules = [ ]; 14 | boot.kernelModules = [ "kvm-intel" ]; 15 | boot.extraModulePackages = [ ]; 16 | 17 | fileSystems."/" = 18 | { 19 | device = "sys_pool_2/root/nixos"; 20 | fsType = "zfs"; 21 | }; 22 | 23 | fileSystems."/home" = 24 | { 25 | device = "sys_pool_2/home"; 26 | fsType = "zfs"; 27 | }; 28 | 29 | boot.zfs.extraPools = [ "bu_pool" ]; 30 | 31 | #fileSystems."/boot" = 32 | #{ device = "/dev/disk/by-uuid/1AFD-DA91"; 33 | #fsType = "vfat"; 34 | #}; 35 | 36 | swapDevices = 37 | [{ device = "/dev/disk/by-id/wwn-0x5000c5005f5cb3b3-part1"; }]; 38 | 39 | powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; 40 | } 41 | -------------------------------------------------------------------------------- /machines/mixos/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | { 3 | imports = 4 | [ 5 | 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # non realtime: 11 | ../../commonNonRT.nix 12 | # music tweaks and progs: 13 | ../../music.nix 14 | ]; 15 | 16 | networking.hostName = "mixos"; 17 | 18 | services = { 19 | xserver = { 20 | autorun = false; 21 | windowManager.default = "i3"; 22 | windowManager.i3.enable = true; 23 | }; 24 | nix-serve = { 25 | enable = true; 26 | secretKeyFile = "/etc/nix/nix-serve.sec"; 27 | }; 28 | # name the soundcards 29 | udev.extraRules = '' 30 | DEVPATH=="/devices/pci0000:00/0000:00:1e.0/0000:04:01.0/sound/card?", ATTR{id}="RME_0" 31 | DEVPATH=="/devices/pci0000:00/0000:00:1e.0/0000:04:02.0/sound/card?", ATTR{id}="RME_1" 32 | ''; 33 | }; 34 | 35 | 36 | boot.blacklistedKernelModules = [ "mgag200" ]; 37 | 38 | #for running alsa trough jack 39 | # boot.kernelModules = [ "snd-aloop" ]; 40 | #sound.enableMediaKeys = true; 41 | 42 | musnix.rtirq.nameList = "rtc0 snd"; 43 | # musnix.rtirq.nonThreaded = "rtc0 snd_rme9652"; 44 | } 45 | -------------------------------------------------------------------------------- /machines/nix14/rt.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; { 3 | imports = [ 4 | /etc/nixos/hardware-configuration.nix 5 | # 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # on every RT machine: 11 | ../../commonRT.nix 12 | # music tweaks and progs: 13 | ../../music.nix 14 | ]; 15 | 16 | 17 | networking.hostName = "nix14-rt"; 18 | musnix = 19 | { 20 | rtirq.nameList = "rtc0 usb"; 21 | }; 22 | 23 | # nixos-rebuild test -p rt -I nixos-config=/home/bart/nixosConfig/machines/thinknix/rt.nix -I nixpkgs=$NIXPKGS 24 | # nixos-rebuild switch -p rt -I nixos-config=/home/bart/nixosConfig/machines/thinknix/rt.nix -I nixpkgs=$NIXPKGS 25 | 26 | 27 | # per device: 28 | services.jack.jackd.extraOptions = [ 29 | # "-v" "-P71" "-p1024" "-dalsa" "-dhw:PCH" "-r48000" "-p2048" "-n2" "-P" 30 | "-P71" 31 | "-p2048" 32 | "-dalsa" 33 | "-dhw:USB" 34 | "-r48000" 35 | "-p4096" 36 | "-n3" 37 | ]; 38 | 39 | # use throttled to not throttle CPU early (thanks Lenovo) 40 | services.throttled.enable = true; 41 | 42 | # environment.sessionVariables = { 43 | # NIXOS_CONFIG = "/home/bart/nixosConfig/machines/nix14/rt.nix"; 44 | # }; 45 | } 46 | -------------------------------------------------------------------------------- /machines/nixframe/rt.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; { 3 | imports = [ 4 | ./hardware-configuration.nix 5 | # 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # on every RT machine: 11 | ../../commonRT.nix 12 | # music tweaks and progs: 13 | ../../music.nix 14 | ]; 15 | 16 | 17 | networking.hostName = "nixframe-rt"; 18 | musnix = 19 | { 20 | rtirq.nameList = "rtc0 usb"; 21 | }; 22 | 23 | # nixos-rebuild test -p rt -I nixos-config=/home/bart/nixosConfig/machines/thinknix/rt.nix -I nixpkgs=$NIXPKGS 24 | # nixos-rebuild switch -p rt -I nixos-config=/home/bart/nixosConfig/machines/thinknix/rt.nix -I nixpkgs=$NIXPKGS 25 | 26 | 27 | # per device: 28 | services.jack.jackd.extraOptions = [ 29 | # "-v" "-P71" "-p1024" "-dalsa" "-dhw:PCH" "-r48000" "-p2048" "-n2" "-P" 30 | "-P71" 31 | "-p2048" 32 | "-dalsa" 33 | "-dhw:USB" 34 | "-r48000" 35 | "-p4096" 36 | "-n3" 37 | ]; 38 | 39 | # use throttled to not throttle CPU early (thanks Lenovo) 40 | # services.throttled.enable = true; 41 | 42 | # environment.sessionVariables = { 43 | # NIXOS_CONFIG = "/home/bart/nixosConfig/machines/nix14/rt.nix"; 44 | # }; 45 | } 46 | -------------------------------------------------------------------------------- /machines/thinknix/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; { 3 | imports = [ 4 | 5 | # machine specific: 6 | ./machine.nix 7 | # on every machine: 8 | ../../common.nix 9 | # non realtime: 10 | ../../commonNonRT.nix 11 | # music tweaks and progs: 12 | ../../music.nix 13 | ]; 14 | 15 | networking = { hostName = "thinknix"; }; 16 | 17 | services.tlp.enable = true; 18 | 19 | # hardware.pulseaudio.enable = true; 20 | 21 | # boot.kernelPackages = pkgs.linuxPackages_4_19; 22 | boot.kernelPackages = pkgs.linuxPackages_latest; 23 | # boot.kernelPackages = pkgs.linuxPackages_testing; 24 | 25 | musnix = { 26 | # enable = true; 27 | # kernel.optimize = true; 28 | # kernel.realtime = true; 29 | rtirq.nameList = "rtc0 usb"; 30 | }; 31 | 32 | # /nix/var/nix/profiles/system-profiles/rt/sw/lib/lv2 33 | environment.variables = { 34 | DSSI_PATH = "$HOME/.dssi:$HOME/.nix-profile/lib/dssi:/run/current-system/sw/lib/dssi"; 35 | LADSPA_PATH = "$HOME/.ladspa:$HOME/.nix-profile/lib/ladspa:/run/current-system/sw/lib/ladspa"; 36 | LV2_PATH = "$HOME/.lv2:$HOME/.nix-profile/lib/lv2:/run/current-system/sw/lib/lv2"; 37 | LXVST_PATH = "$HOME/.lxvst:$HOME/.nix-profile/lib/lxvst:/run/current-system/sw/lib/lxvst"; 38 | VST_PATH = "$HOME/.vst:$HOME/.nix-profile/lib/vst:/run/current-system/sw/lib/vst"; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /machines/compnix/remote_i3.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | with lib; 4 | 5 | let 6 | wmCfg = config.services.xserver.windowManager; 7 | 8 | i3option = name: { 9 | enable = mkEnableOption name; 10 | configFile = mkOption { 11 | default = null; 12 | type = types.nullOr types.path; 13 | description = '' 14 | Path to the i3 configuration file. 15 | If left at the default value, $HOME/.i3/config will be used. 16 | ''; 17 | }; 18 | extraSessionCommands = mkOption { 19 | default = ""; 20 | type = types.lines; 21 | description = '' 22 | Shell commands executed just before i3 is started. 23 | ''; 24 | }; 25 | }; 26 | 27 | i3config = name: pkg: cfg: { 28 | services.xserver.windowManager.session = [{ 29 | inherit name; 30 | start = '' 31 | ${cfg.extraSessionCommands} 32 | 33 | ${pkgs.openssh}/bin/ssh -Y 2.2.2.2 i3 ${optionalString (cfg.configFile != null) 34 | "-c \"${cfg.configFile}\"" 35 | } & 36 | waitPID=$! 37 | ''; 38 | }]; 39 | environment.systemPackages = [ pkg ]; 40 | }; 41 | 42 | in 43 | 44 | { 45 | options.services.xserver.windowManager = { 46 | remote_i3 = i3option "remote_i3"; 47 | # i3-gaps = i3option "i3-gaps"; 48 | }; 49 | 50 | config = mkMerge [ 51 | (mkIf wmCfg.remote_i3.enable (i3config "remote_i3" pkgs.i3 wmCfg.remote_i3)) 52 | ]; 53 | } 54 | -------------------------------------------------------------------------------- /commonRT.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | { 4 | 5 | services.tlp.enable = false; 6 | # services.pipewire.config.client-rt 7 | # boot.kernelPackages = pkgs.linux_rt.linux_4_19_rt; 8 | # boot.kernelPackages = pkgs.linuxPackages-rt_5_4; 9 | # boot.kernelPackages = pkgs.linuxPackages-rt_5_10; 10 | # boot.kernelPackages = pkgs.linuxPackages_rt_5_15 ; 11 | # boot.kernelPackages = pkgs.linuxPackages-rt_6_1; 12 | # boot.kernelPackages = pkgs.linuxPackages-rt; 13 | boot.kernelPackages = pkgs.linuxPackages-rt_latest; 14 | 15 | # sound.enable = true; 16 | 17 | musnix = { 18 | enable = true; 19 | # kernel.packages = pkgs.linuxPackages_5_15_rt; 20 | # kernel.packages = pkgs.linuxPackages_6_1_rt; 21 | # kernel.packages = pkgs.linuxPackages_latest_rt; 22 | # kernel.realtime = true; 23 | rtirq.enable = true; 24 | das_watchdog.enable = true; 25 | }; 26 | 27 | 28 | hardware.pulseaudio.enable = false; 29 | 30 | services = { 31 | pipewire.enable = false; 32 | # alsa.enable = true; 33 | jack = { 34 | jackd = { 35 | # enable = true; 36 | # per device: 37 | # extraOptions = [ 38 | # "-v" "-P71" "-p1024" "-dalsa" "-dhw:PCH" "-r48000" "-p2048" "-n2" "-P" 39 | # ]; 40 | session = "a2jmidid -e"; 41 | }; 42 | # support ALSA only programs via ALSA JACK PCM pluginor loopback 43 | alsa.enable = true; 44 | # loopback = { 45 | # enable = true; 46 | # config = ""; 47 | # }; 48 | }; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /commonNonRT.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | { 4 | 5 | # Remove sound.enable or turn it off if you had it set previously, it seems to cause conflicts with pipewire 6 | # sound.enable = false; 7 | # pipewire 8 | security.rtkit.enable = true; # rtkit is optional but recommended for PipeWire 9 | services.pipewire = { 10 | enable = true; 11 | alsa.enable = true; 12 | alsa.support32Bit = true; 13 | jack.enable = true; 14 | pulse.enable = true; 15 | socketActivation = true; 16 | # config.pipewire = { 17 | # "context.properties" = { 18 | # "link.max-buffers" = 16; # version < 3 clients can't handle more than this 19 | # "log.level" = 2; # https://docs.pipewire.org/#Logging 20 | # "default.clock.rate" = 48000; 21 | # "default.clock.allowed-rates" = [ 44100 48000 88200 96000 ]; 22 | # "default.clock.quantum" = 1024; 23 | # "default.clock.min-quantum" = 32; 24 | # "default.clock.max-quantum" = 8192; 25 | # }; 26 | # }; 27 | # wireplumber.enable = true; // default 28 | }; 29 | 30 | # virtualisation = { 31 | # docker.enable = true; 32 | # virtualbox = 33 | # { 34 | # host.enable = true; 35 | # # host.enableExtensionPack = true; 36 | # }; 37 | 38 | # }; 39 | # users.extraGroups.vboxusers.members = [ "bart" ]; 40 | 41 | # virtualisation.libvirtd.enable = true; 42 | 43 | 44 | # Minimal configuration for NFS support with Vagrant. 45 | # services.nfs.server.enable = true; 46 | 47 | # Add firewall exception for VirtualBox provider 48 | # networking.firewall.extraCommands = '' 49 | # ip46tables -I INPUT 1 -i vboxnet+ -p tcp -m tcp --dport 2049 -j ACCEPT 50 | # ''; 51 | 52 | # Add firewall exception for libvirt provider when using NFSv4 53 | # networking.firewall.interfaces."virbr1" = { 54 | # allowedTCPPorts = [ 2049 ]; 55 | # allowedUDPPorts = [ 2049 ]; 56 | # }; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /machines/nixpire/machine.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | 3 | let 4 | # blkid 5 | rootUUID = "9b4bc91f-c9d2-413a-811f-34eb21232388"; 6 | swapUUID = "5a88c244-4690-4524-bcb2-76b700475378"; 7 | # ls /dev/disk/by-id/ 8 | diskID = "ata-ST9160310AS_5SV8AVRQ-0:0"; 9 | in 10 | { 11 | imports = 12 | [ 13 | 14 | ]; 15 | 16 | boot = 17 | { 18 | # dependant on amount of ram: 19 | tmpOnTmpfs = false; 20 | loader.grub.device = "/dev/disk/by-id/${diskID}"; 21 | loader.grub.extraEntries = import ./extraGrub.nix; 22 | #copy from /etc/nixos/hardware-configuration.nix 23 | initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ata_piix" "ahci" "usb_storage" ]; 24 | kernelModules = [ ]; 25 | extraModulePackages = [ ]; 26 | }; 27 | 28 | fileSystems = 29 | { 30 | "/" = 31 | { 32 | device = "/dev/disk/by-uuid/${rootUUID}"; 33 | fsType = "ext3"; 34 | options = "noatime,errors=remount-ro"; 35 | }; 36 | /*"/home" =*/ 37 | /*{ device = "/dev/disk/by-uuid/${homeUUID}";*/ 38 | /*fsType = "ext3";*/ 39 | /*options = "noatime,errors=remount-ro";*/ 40 | /*};*/ 41 | }; 42 | 43 | swapDevices = [{ 44 | device = "/dev/disk/by-uuid/${swapUUID}"; 45 | }]; 46 | 47 | nix.maxJobs = 2; 48 | 49 | networking = { 50 | # interfaces = { enp1s0 = { ipAddress = "2.2.2.1"; subnetMask = "255.255.255.255"; } ; }; 51 | connman.enable = true; 52 | wireless.enable = true; 53 | }; 54 | services = { 55 | smartd = { 56 | enable = true; 57 | devices = [ 58 | { device = "/dev/sda"; } 59 | # { device = "/dev/nvme0n1"; } 60 | # { device = "/dev/sdb"; } 61 | ]; 62 | notifications.test = true; 63 | notifications.x11.enable = true; 64 | }; 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /machines/mixos/machine.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | 3 | let 4 | # blkid 5 | rootUUID = "51a39d20-38ef-4cd0-a0fb-afe721ae3adc"; 6 | homeUUID = "052156b0-5203-47e0-a622-a9058215308c"; 7 | swapUUID = "786fef46-79af-4247-940b-68872ef2e2a3"; 8 | # ls /dev/disk/by-id/ 9 | diskID = "ata-Samsung_SSD_850_EVO_120GB_S21UNSAG134647X"; 10 | in 11 | { 12 | imports = 13 | [ 14 | 15 | ]; 16 | 17 | boot = 18 | { 19 | # dependant on amount of ram: 20 | #tmpOnTmpfs = true; 21 | #loader.grub.device = "/dev/sdd"; 22 | loader.grub.device = "/dev/disk/by-id/${diskID}"; 23 | #loader.grub.extraEntries = import ./extraGrub.nix; 24 | #copy from /etc/nixos/hardware-configuration.nix 25 | /*kernelPackages.kernel.system = "x86_64-linux";*/ 26 | # initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" ]; 27 | # kernelModules = [ "kvm-intel" ]; 28 | extraModulePackages = [ ]; 29 | postBootCommands = '' 30 | ${pkgs.pciutils}/bin/setpci -v -s '04:01.0' latency_timer=ff 31 | ${pkgs.pciutils}/bin/setpci -v -s '04:02.0' latency_timer=ff 32 | ${pkgs.pciutils}/bin/setpci -v -s '04:03.0' latency_timer=40 33 | ''; 34 | }; 35 | 36 | fileSystems = 37 | { 38 | "/" = 39 | { 40 | /*device = "/dev/sde1";*/ 41 | device = "/dev/disk/by-uuid/${rootUUID}"; 42 | fsType = "ext4"; 43 | options = [ "relatime" "errors=remount-ro" ]; 44 | }; 45 | "/home" = 46 | { 47 | device = "/dev/disk/by-uuid/${homeUUID}"; 48 | fsType = "ext4"; 49 | options = [ "relatime" "errors=remount-ro" ]; 50 | }; 51 | }; 52 | 53 | swapDevices = [{ 54 | device = "/dev/disk/by-uuid/${swapUUID}"; 55 | }]; 56 | 57 | nix.maxJobs = 4; 58 | 59 | nixpkgs.system = "x86_64-linux"; 60 | 61 | networking = { 62 | interfaces.enp3s0 = { 63 | ipAddress = "2.2.2.2"; 64 | prefixLength = 24; 65 | }; 66 | #networkmanager.enable = true; 67 | connman.enable = false; 68 | wireless.enable = false; 69 | 70 | services = { 71 | smartd = { 72 | enable = true; 73 | devices = [ 74 | { device = "/dev/sda"; } 75 | # { device = "/dev/nvme0n1"; } 76 | # { device = "/dev/sdb"; } 77 | ]; 78 | notifications.test = true; 79 | notifications.x11.enable = true; 80 | }; 81 | 82 | } 83 | 84 | }; 85 | } 86 | -------------------------------------------------------------------------------- /treefmt.toml: -------------------------------------------------------------------------------- 1 | # The formatter multiplexer - https://github.com/numtide/treefmt 2 | 3 | [formatter.nix] 4 | command = "nixpkgs-fmt" 5 | includes = ["*.nix"] 6 | 7 | # Do not exit with error if a configured formatter is missing 8 | # Env $TREEFMT_ALLOW_MISSING_FORMATTER 9 | # allow-missing-formatter = true 10 | 11 | # The file into which a cpu profile will be written 12 | # Env $TREEFMT_CPU_PROFILE 13 | # cpu-profile = ./cpu.pprof 14 | 15 | # Exclude files or directories matching the specified globs 16 | # Env $TREEFMT_EXCLUDES 17 | # excludes = ["*.md", "*.gif"] 18 | 19 | # Exit with error if any changes were made during execution 20 | # Useful for CI 21 | # Env $TREEFMT_FAIL_ON_CHANGE 22 | # fail-on-change = true 23 | 24 | # A list of formatters to apply 25 | # Defaults to all configured formatters 26 | # Env $TREEFMT_FORMATTERS 27 | # formatters = ["gofmt", "prettier"] 28 | 29 | # Log paths that did not match any formatters at the specified log level 30 | # Possible values are 31 | # Env $TREEFMT_ON_UNMATCHED 32 | # on-unmatched = "info" 33 | 34 | # The root directory from which treefmt will start walking the filesystem 35 | # Defaults to the root of the current git worktree. 36 | # If not in a git repo, defaults to the directory containing the config file. 37 | # Env $TREEFMT_TREE_ROOT 38 | # tree-root = "/tmp/foo" 39 | 40 | # File to search for to find the tree root (if tree-root is not set) 41 | # Env $TREEFMT_TREE_ROOT_FILE 42 | # tree-root-file = ".git/config" 43 | 44 | # Command to run to find the tree root. It is parsed using shlex, to allow quoting arguments that contain whitespace. 45 | # If you wish to pass arguments containing quotes, you should use nested quotes e.g. "'" or '"' 46 | # Env $TREEFMT_TREE_ROOT_CMD 47 | # tree-root-cmd = "git rev-parse --show-toplevel" 48 | 49 | # Set the verbosity of logs 50 | # 0 = warn, 1 = info, 2 = debug 51 | # Env $TREEFMT_VERBOSE 52 | # verbose = 2 53 | 54 | # The method used to traverse the files within the tree root 55 | # Currently, we support 'auto', 'git', 'jujutsu', or 'filesystem' 56 | # Env $TREEFMT_WALK 57 | # walk = "filesystem" 58 | 59 | # [formatter.mylanguage] 60 | # Command to execute 61 | # command = "command-to-run" 62 | # Command-line arguments for the command 63 | # options = [] 64 | # Glob pattern of files to include 65 | # includes = [ "*." ] 66 | # Glob patterns of files to exclude 67 | # excludes = [] 68 | # Controls the order of application when multiple formatters match the same file 69 | # Lower the number, the higher the precedence 70 | # Default is 0 71 | # priority = 0 72 | -------------------------------------------------------------------------------- /machines/nixframe/hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | { config, lib, pkgs, modulesPath, ... }: 5 | 6 | { 7 | imports = 8 | [ 9 | (modulesPath + "/installer/scan/not-detected.nix") 10 | ]; 11 | 12 | boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; 13 | boot.initrd.kernelModules = [ ]; 14 | boot.kernelModules = [ "kvm-intel" ]; 15 | boot.extraModulePackages = [ ]; 16 | 17 | fileSystems."/" = 18 | { 19 | device = "rpool/nixos/root"; 20 | fsType = "zfs"; 21 | options = [ "zfsutil" "X-mount.mkdir" ]; 22 | }; 23 | 24 | fileSystems."/home" = 25 | { 26 | device = "rpool/nixos/home"; 27 | fsType = "zfs"; 28 | options = [ "zfsutil" "X-mount.mkdir" ]; 29 | }; 30 | 31 | fileSystems."/var/lib" = 32 | { 33 | device = "rpool/nixos/var/lib"; 34 | fsType = "zfs"; 35 | options = [ "zfsutil" "X-mount.mkdir" ]; 36 | }; 37 | 38 | fileSystems."/var/log" = 39 | { 40 | device = "rpool/nixos/var/log"; 41 | fsType = "zfs"; 42 | options = [ "zfsutil" "X-mount.mkdir" ]; 43 | }; 44 | 45 | fileSystems."/boot" = 46 | { 47 | device = "bpool/nixos/root"; 48 | fsType = "zfs"; 49 | options = [ "zfsutil" "X-mount.mkdir" ]; 50 | }; 51 | 52 | fileSystems."/boot/efis/nvme-WD_BLACK_SN850X_1000GB_223761800744-part1" = 53 | { 54 | device = "/dev/disk/by-uuid/A366-D51A"; 55 | fsType = "vfat"; 56 | }; 57 | 58 | fileSystems."/boot/efi" = 59 | { 60 | device = "/boot/efis/nvme-WD_BLACK_SN850X_1000GB_223761800744-part1"; 61 | fsType = "none"; 62 | options = [ "bind" ]; 63 | }; 64 | 65 | swapDevices = [ ]; 66 | 67 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking 68 | # (the default) this is the recommended approach. When using systemd-networkd it's 69 | # still possible to use this option, but it's recommended to use it in conjunction 70 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`. 71 | networking.useDHCP = lib.mkDefault true; 72 | # networking.interfaces.enp0s13f0u1c2.useDHCP = lib.mkDefault true; 73 | # networking.interfaces.wlp166s0.useDHCP = lib.mkDefault true; 74 | 75 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 76 | powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; 77 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; 78 | } 79 | -------------------------------------------------------------------------------- /synaptics.nix: -------------------------------------------------------------------------------- 1 | { 2 | accelFactor = "0.0350939"; 3 | enable = true; 4 | twoFingerScroll = true; 5 | vertEdgeScroll = false; 6 | horizTwoFingerScroll = false; 7 | # horizEdgeScroll = true; 8 | minSpeed = "0.6"; 9 | maxSpeed = "1.75"; 10 | palmDetect = true; 11 | # disable paste with 2 fingers: 12 | additionalOptions = '' 13 | Option "TapButton2" "3" 14 | ''; 15 | # Driver "synaptics" 16 | # MatchIsTouchpad "on" 17 | # Option "LeftEdge" "1781" 18 | # Option "RightEdge" "5579" 19 | # Option "TopEdge" "1660" 20 | # Option "BottomEdge" "4760" 21 | # Option "FingerLow" "25" 22 | # Option "FingerHigh" "30" 23 | # Option "FingerPress" "256" 24 | # Option "MaxTapTime" "259" 25 | # Option "MaxTapMove" "265" 26 | # Option "MaxDoubleTapTime" "180" 27 | # Option "SingleTapTimeout" "180" 28 | # Option "ClickTime" "100" 29 | # Option "FastTaps" "1" 30 | # Option "EmulateMidButtonTime" "75" 31 | # Option "EmulateTwoFingerMinZ" "282" 32 | # Option "EmulateTwoFingerMinW" "7" 33 | # Option "VertScrollDelta" "111" 34 | # Option "HorizScrollDelta" "111" 35 | # Option "VertEdgeScroll" "0" 36 | # Option "HorizEdgeScroll" "1" 37 | # Option "CornerCoasting" "0" 38 | # Option "VertTwoFingerScroll" "1" 39 | # Option "HorizTwoFingerScroll" "0" 40 | # Option "AccelFactor" "0.0350939" 41 | # Option "TrackstickSpeed" "40" 42 | # Option "EdgeMotionMinZ" "30" 43 | # Option "EdgeMotionMaxZ" "160" 44 | # Option "EdgeMotionMinSpeed" "1" 45 | # Option "EdgeMotionMaxSpeed" "455" 46 | # Option "EdgeMotionUseAlways" "0" 47 | # Option "TouchpadOff" "0" 48 | # Option "LockedDrags" "0" 49 | # Option "LockedDragTimeout" "5000" 50 | # Option "RTCornerButton" "0" 51 | # Option "RBCornerButton" "0" 52 | # Option "LTCornerButton" "0" 53 | # Option "LBCornerButton" "0" 54 | # Option "TapButton1" "1" 55 | # Option "TapButton2" "3" 56 | # Option "TapButton3" "2" 57 | # Option "ClickFinger1" "1" 58 | # Option "ClickFinger2" "1" 59 | # Option "ClickFinger3" "1" 60 | # Option "CircularScrolling" "0" 61 | # Option "CircScrollDelta" "0.1" 62 | # Option "CircScrollTrigger" "0" 63 | # Option "CircularPad" "0" 64 | # Option "PalmMinWidth" "10" 65 | # Option "PalmMinZ" "200" 66 | # Option "CoastingSpeed" "20" 67 | # Option "CoastingFriction" "50" 68 | # Option "PressureMotionMinZ" "30" 69 | # Option "PressureMotionMaxZ" "160" 70 | # Option "PressureMotionMinFactor" "1" 71 | # Option "PressureMotionMaxFactor" "1" 72 | # Option "GrabEventDevice" "1" 73 | # Option "TapAndDragGesture" "1" 74 | # Option "AreaLeftEdge" "0" 75 | # Option "AreaRightEdge" "0" 76 | # Option "AreaTopEdge" "0" 77 | # Option "AreaBottomEdge" "0" 78 | # Option "HorizHysteresis" "28" 79 | # Option "VertHysteresis" "28" 80 | # Option "ClickPad" "0" 81 | # ''; 82 | } 83 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Deployment for my server"; 3 | 4 | # For accessing `deploy-rs`'s utility Nix functions 5 | inputs.deploy-rs.url = "github:serokell/deploy-rs"; 6 | inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 7 | # inputs.nixpkgs.url = "path:/home/bart/source/nixpkgs"; 8 | inputs.nixos-hardware.url = "github:NixOS/nixos-hardware"; 9 | inputs.musnix.url = "github:musnix/musnix"; 10 | inputs.nur = { 11 | url = "github:nix-community/NUR"; 12 | inputs.nixpkgs.follows = "nixpkgs"; 13 | }; 14 | 15 | inputs.bandithedoge = { 16 | url = "github:bandithedoge/nur-packages"; 17 | inputs.nixpkgs.follows = "nixpkgs"; 18 | }; 19 | 20 | outputs = inputs @ { self, nixpkgs, deploy-rs, musnix, nur, bandithedoge, ... }: 21 | let 22 | system = "x86_64-linux"; 23 | in 24 | { 25 | nixosConfigurations.nixframe = nixpkgs.lib.nixosSystem { 26 | inherit system; 27 | modules = [ 28 | ./machines/nixframe/default.nix 29 | inputs.nixos-hardware.nixosModules.framework-12th-gen-intel 30 | musnix.nixosModules.musnix 31 | ({ pkgs, ... }: { 32 | nixpkgs.overlays = [ 33 | nur.overlays.default 34 | ]; 35 | }) 36 | ]; 37 | specialArgs = { 38 | inherit bandithedoge; 39 | }; 40 | }; 41 | 42 | # nixosConfigurations.nixframe-rt = nixpkgs.lib.nixosSystem { 43 | # inherit system; 44 | # modules = [ 45 | # ./machines/nixframe/rt.nix 46 | # inputs.nixos-hardware.nixosModules.framework-12th-gen-intel 47 | # musnix.nixosModules.musnix 48 | # ({ pkgs, ... }: { 49 | # nixpkgs.overlays = [ nur.overlay ]; 50 | # }) 51 | # ]; 52 | # specialArgs = { 53 | # inherit bandithedoge; 54 | # }; 55 | # }; 56 | 57 | nixosConfigurations.pronix = nixpkgs.lib.nixosSystem { 58 | inherit system; 59 | modules = [ 60 | ./machines/pronix/configuration.nix 61 | ]; 62 | }; 63 | 64 | deploy.nodes.pronix = { 65 | hostname = "81.206.32.45"; # or your pronix's real hostname or IP 66 | sshUser = "bart"; 67 | user = "root"; 68 | # Whether to enable interactive sudo (password based sudo). Useful when using non-root sshUsers. 69 | # This defaults to `false` 70 | interactiveSudo = true; 71 | # This is an optional list of arguments that will be passed to SSH. 72 | sshOpts = [ "-p" "511" ]; 73 | remoteBuild = true; 74 | profiles.system = { 75 | user = "root"; 76 | path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.pronix; 77 | }; 78 | }; 79 | 80 | # This is highly advised, and will prevent many possible mistakes 81 | checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; 82 | }; 83 | } 84 | -------------------------------------------------------------------------------- /machines/borknix/machine.nix.home.network: -------------------------------------------------------------------------------- 1 | {pkgs, config, ...}: with pkgs; 2 | 3 | let 4 | # blkid 5 | rootUUID = "43fa23cf-00a6-4672-9a38-4e231eebdc79"; 6 | homeUUID = "661bf9a9-6fbe-4c57-9138-a6cb0e042d0e"; 7 | swapUUID = "bf91febd-08a1-4601-9c04-fbdd4351a8a8"; 8 | # ls /dev/disk/by-id/ 9 | diskID = "ata-Hitachi_HTS541616J9SA00_SB2404GJG5MWEE"; 10 | in 11 | { 12 | imports = 13 | [ 14 | ]; 15 | 16 | boot = 17 | { # dependant on amount of ram: 18 | # mount -o remount,size=4G /tmp and your /tmp/ is now bigger 19 | tmpOnTmpfs = false; 20 | #loader.grub.device = "/dev/sda"; 21 | loader.grub.device = "/dev/disk/by-id/${diskID}"; 22 | #loader.grub.extraEntries = import ./extraGrub.nix; 23 | #copy from /etc/nixos/hardware-configuration.nix 24 | initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ata_piix" "ahci" "usb_storage" ]; 25 | kernelModules = [ ]; 26 | extraModulePackages = [ ]; 27 | }; 28 | 29 | fileSystems = 30 | { 31 | "/" = 32 | { 33 | #device = "/dev/disk/by-label/nixos"; 34 | device = "/dev/disk/by-uuid/${rootUUID}"; 35 | fsType = "ext4"; 36 | options = "noatime,errors=remount-ro"; 37 | }; 38 | "/home" = 39 | { 40 | #device = "/dev/disk/by-label/home"; 41 | device = "/dev/disk/by-uuid/${homeUUID}"; 42 | fsType = "ext4"; 43 | options = "noatime,errors=remount-ro"; 44 | }; 45 | /*"/tmp" =*/ 46 | /*{ device = "/dev/disk/by-uuid/43fa23cf-00a6-4672-9a38-4e231eebdc79";*/ 47 | /*fsType = "ext4";*/ 48 | /*options = "noatime,errors=remount-ro";*/ 49 | /*};*/ 50 | }; 51 | 52 | swapDevices = [{ 53 | device = "/dev/disk/by-uuid/${swapUUID}"; 54 | #device = "/dev/disk/by-label/swap"; 55 | }]; 56 | 57 | nix.maxJobs = 2; 58 | 59 | networking = { 60 | interfaces.enp1s7 = { 61 | useDHCP = false; 62 | ip4 = [ { address = "2.2.2.2"; prefixLength = 24; } ]; 63 | #ipAddress = "2.2.2.2"; 64 | #prefixLength = 24; 65 | }; 66 | #networkmanager.enable = true; 67 | connman.enable = true; 68 | # fix connman static IP: 69 | localCommands = "${inetutils}/bin/ifconfig enp1s7 192.168.0.21 netmask 255.255.255.0 gateway 192.168.0.1 up"; 70 | nameservers = [ "192.168.0.1" ]; 71 | wireless.enable = true; 72 | }; 73 | services = { 74 | smartd = { 75 | enable = true; 76 | devices = [ 77 | { device = "/dev/sda"; } 78 | # { device = "/dev/nvme0n1"; } 79 | # { device = "/dev/sdb"; } 80 | ]; 81 | notifications.test = true; 82 | notifications.x11.enable = true; 83 | }; 84 | 85 | }; 86 | 87 | services.xserver.vaapiDrivers = [ pkgs.vaapiIntel ]; 88 | /*services.dnsmasq.enable = true;*/ 89 | #services.dnsmasq.resolveLocalQueries = false; 90 | /*services.dnsmasq.extraConfig = ''*/ 91 | /*port=0*/ 92 | /*interface=enp1s7*/ 93 | /*dhcp-range=2.2.2.1,2.2.2.1,infinite*/ 94 | /*'';*/ 95 | } 96 | 97 | /*dhcp-host=00:19:bb:e1:07:7c,2.2.2.3,infinite*/ 98 | 99 | /*dhcp-host=nixpire,2.2.2.1*/ 100 | /*dhcp-range=2.2.2.1,2.2.2.3,12h*/ 101 | -------------------------------------------------------------------------------- /machines/nix14/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; { 3 | imports = [ 4 | /etc/nixos/hardware-configuration.nix 5 | # 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # non realtime: 11 | ../../commonNonRT.nix 12 | # music tweaks and progs: 13 | ../../music.nix 14 | ]; 15 | 16 | networking = { hostName = "nix14"; }; 17 | 18 | services.tlp = { 19 | enable = true; 20 | settings = { 21 | START_CHARGE_THRESH_BAT0 = "70"; 22 | STOP_CHARGE_THRESH_BAT0 = "90"; 23 | CPU_SCALING_GOVERNOR_ON_AC = "performance"; 24 | CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; 25 | CPU_BOOST_ON_AC = "1"; 26 | CPU_BOOST_ON_BAT = "0"; 27 | CPU_HWP_DYN_BOOST_ON_AC = "1"; 28 | CPU_HWP_DYN_BOOST_ON_BAT = "0"; 29 | CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; 30 | CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; 31 | CIE_ASPM_ON_AC = "performance"; 32 | CIE_ASPM_ON_BAT = "powersupersave"; 33 | INTEL_GPU_MIN_FREQ_ON_AC = "300"; 34 | INTEL_GPU_MIN_FREQ_ON_BAT = "300"; 35 | INTEL_GPU_MAX_FREQ_ON_AC = "1150"; 36 | INTEL_GPU_MAX_FREQ_ON_BAT = "300"; 37 | INTEL_GPU_BOOST_FREQ_ON_AC = "1150"; 38 | INTEL_GPU_BOOST_FREQ_ON_BAT = "300"; 39 | ENERGY_PERF_POLICY_ON_BAT = "powersave"; 40 | # DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE = "wifi"; 41 | DEVICES_TO_DISABLE_ON_LAN_CONNECT = "wifi"; 42 | DEVICES_TO_ENABLE_ON_LAN_DISCONNECT = "wifi"; 43 | # Enable audio power saving for Intel HDA, AC97 devices (timeout in secs). 44 | # A value of 0 disables, >= 1 enables power saving. 45 | # Note: 1 is recommended for Linux desktop environments with PulseAudio, 46 | # systems without PulseAudio may require 10. 47 | # Default: 1 48 | 49 | SOUND_POWER_SAVE_ON_AC = "0"; 50 | SOUND_POWER_SAVE_ON_BAT = "1"; 51 | # Disable controller too (HDA only): Y/N. 52 | # Note: effective only when SOUND_POWER_SAVE_ON_AC/BAT is activated. 53 | # Default: Y 54 | # SOUND_POWER_SAVE_CONTROLLER = "N"; 55 | USB_EXCLUDE_PHONE = "1"; 56 | }; 57 | }; 58 | # hardware.pulseaudio.enable = true; 59 | 60 | # boot.kernelPackages = pkgs.linuxPackages_4_19; 61 | # boot.kernelPackages = pkgs.linuxPackages_5_4; 62 | # boot.kernelPackages = pkgs.linuxPackages_5_10; 63 | # boot.kernelPackages = pkgs.linuxPackages_5_11; 64 | # boot.kernelPackages = pkgs.linuxPackages_5_15; 65 | boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; 66 | # boot.kernelPackages = pkgs.linuxPackages_latest; 67 | # boot.kernelPackages = pkgs.linuxPackages_testing; 68 | 69 | musnix = { 70 | # enable = true; 71 | # kernel.optimize = true; 72 | # kernel.realtime = true; 73 | rtirq.nameList = "rtc0 usb"; 74 | }; 75 | 76 | # /nix/var/nix/profiles/system-profiles/rt/sw/lib/lv2 77 | environment.variables = { 78 | DSSI_PATH = "$HOME/.dssi:$HOME/.nix-profile/lib/dssi:/run/current-system/sw/lib/dssi"; 79 | LADSPA_PATH = "$HOME/.ladspa:$HOME/.nix-profile/lib/ladspa:/run/current-system/sw/lib/ladspa"; 80 | LV2_PATH = "$HOME/.lv2:$HOME/.nix-profile/lib/lv2:/run/current-system/sw/lib/lv2"; 81 | LXVST_PATH = "$HOME/.lxvst:$HOME/.nix-profile/lib/lxvst:/run/current-system/sw/lib/lxvst"; 82 | VST_PATH = "$HOME/.vst:$HOME/.nix-profile/lib/vst:/run/current-system/sw/lib/vst"; 83 | }; 84 | 85 | # environment.sessionVariables = { 86 | # NIXOS_CONFIG = "/home/bart/nixosConfig/machines/nix14/default.nix"; 87 | # }; 88 | } 89 | -------------------------------------------------------------------------------- /machines/borknix/machine.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | 3 | let 4 | # blkid 5 | rootUUID = "43fa23cf-00a6-4672-9a38-4e231eebdc79"; 6 | homeUUID = "661bf9a9-6fbe-4c57-9138-a6cb0e042d0e"; 7 | swapUUID = "bf91febd-08a1-4601-9c04-fbdd4351a8a8"; 8 | # ls /dev/disk/by-id/ 9 | diskID = "ata-Hitachi_HTS541616J9SA00_SB2404GJG5MWEE"; 10 | in 11 | { 12 | imports = 13 | [ 14 | 15 | ]; 16 | 17 | boot = 18 | { 19 | # dependant on amount of ram: 20 | # mount -o remount,size=4G /tmp and your /tmp/ is now bigger 21 | tmpOnTmpfs = false; 22 | #loader.grub.device = "/dev/sda"; 23 | loader.grub.device = "/dev/disk/by-id/${diskID}"; 24 | #loader.grub.extraEntries = '' 25 | # menuentry 'Tails' 26 | # { set root=(hd0,2) 27 | # set isofile="/bart/Downloads/tails-i386-1.5.iso" 28 | # loopback loop (hd0,2)$isofile 29 | # linux (loop)/live/vmlinuz findiso=$isofile boot=live config apparmor=1 security=apparmor nopersistent noprompt timezone=Etc/UTC 30 | #block.events_dfl_poll_msecs=1000 splash noautologin module=Tails quiet i2p 31 | # initrd (loop)/live/initrd.img 32 | # }''; 33 | #copy from /etc/nixos/hardware-configuration.nix 34 | initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ata_piix" "ahci" "usb_storage" ]; 35 | kernelModules = [ ]; 36 | extraModulePackages = [ ]; 37 | }; 38 | 39 | fileSystems = 40 | { 41 | "/" = 42 | { 43 | #device = "/dev/disk/by-label/nixos"; 44 | device = "/dev/disk/by-uuid/${rootUUID}"; 45 | fsType = "ext4"; 46 | options = [ "relatime" "errors=remount-ro" ]; 47 | }; 48 | "/home" = 49 | { 50 | #device = "/dev/disk/by-label/home"; 51 | device = "/dev/disk/by-uuid/${homeUUID}"; 52 | fsType = "ext4"; 53 | options = [ "relatime" "errors=remount-ro" ]; 54 | }; 55 | /*"/tmp" =*/ 56 | /*{ device = "/dev/disk/by-uuid/43fa23cf-00a6-4672-9a38-4e231eebdc79";*/ 57 | /*fsType = "ext4";*/ 58 | # options = [ "relatime" "errors=remount-ro" ]; 59 | /*};*/ 60 | }; 61 | 62 | swapDevices = [{ 63 | device = "/dev/disk/by-uuid/${swapUUID}"; 64 | #device = "/dev/disk/by-label/swap"; 65 | }]; 66 | 67 | nix = { 68 | requireSignedBinaryCaches = true; 69 | maxJobs = 2; # force remote building 70 | distributedBuilds = true; 71 | buildMachines = [{ hostName = "2.2.2.2"; maxJobs = 4; sshKey = "/root/.ssh/id_rsa"; sshUser = "root"; system = "x86_64-linux"; }]; 72 | 73 | 74 | binaryCaches = [ "2.2.2.2:5000/" "https://cache.nixos.org/" ]; 75 | #binaryCaches = ["2.2.2.2:5000"]; 76 | #binaryCaches = [""]; 77 | # extraOptions = '' 78 | # binary-caches = 2.2.2.2:5000/ 79 | # ''; 80 | binaryCachePublicKeys = [ "mixos:hpj9Ic8KDQp4CH33+KgKRhTeLOi+ixuUEdWtfojfnZY=#" ]; 81 | }; 82 | networking = { 83 | interfaces.enp1s7 = { 84 | # useDHCP = false; 85 | #ip4 = [ { address = "2.2.2.1"; prefixLength = 24; } ]; 86 | }; 87 | #networkmanager.enable = true; 88 | connman.enable = true; 89 | # fix connman static IP: 90 | # localCommands = "${inetutils}/bin/ifconfig enp1s7 2.2.2.1 netmask 255.255.255.0 up"; 91 | #nameservers = [ "192.168.0.1" ]; 92 | #defaultGateway = "192.168.0.1"; 93 | wireless.enable = true; 94 | }; 95 | services = { 96 | # tlp.enable= true; 97 | xserver.displayManager.sessionCommands = 98 | '' 99 | ${pkgs.dzen2}/bin/dzen2 -dock -y 915 -h 125 -bg grey & 100 | ''; 101 | smartd = { 102 | enable = true; 103 | devices = [ 104 | { device = "/dev/sda"; } 105 | # { device = "/dev/nvme0n1"; } 106 | # { device = "/dev/sdb"; } 107 | ]; 108 | notifications.test = true; 109 | notifications.x11.enable = true; 110 | 111 | }; 112 | }; 113 | # powerManagement.cpuFreqGovernor = "powersave"; 114 | # renamed: 115 | # services.xserver.vaapiDrivers = [ pkgs.vaapiIntel ]; 116 | hardware.opengl.extraPackages = [ pkgs.vaapiIntel ]; 117 | /*services.dnsmasq.enable = true;*/ 118 | #services.dnsmasq.resolveLocalQueries = false; 119 | /*services.dnsmasq.extraConfig = ''*/ 120 | /*port=0*/ 121 | /*interface=enp1s7*/ 122 | /*dhcp-range=2.2.2.1,2.2.2.1,infinite*/ 123 | /*'';*/ 124 | } 125 | 126 | /*dhcp-host=00:19:bb:e1:07:7c,2.2.2.3,infinite*/ 127 | 128 | /*dhcp-host=nixpire,2.2.2.1*/ 129 | /*dhcp-range=2.2.2.1,2.2.2.3,12h*/ 130 | -------------------------------------------------------------------------------- /machines/compnix/machine.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: with pkgs; 2 | 3 | let 4 | boot.initrd.availableKernelModules = [ "ata_generic" "uhci_hcd" "ehci_pci" "ata_piix" "usb_storage" "usbhid" "sd_mod" ]; 5 | boot.kernelModules = [ "kvm-intel" ]; 6 | boot.extraModulePackages = [ ]; 7 | # blkid 8 | rootUUID = "a33cd97a-1452-4581-9036-c85f9f925f32"; 9 | homeUUID = "d60e8a3d-0333-4f06-929c-735ad0329b2c"; 10 | swapUUID = "58ab248a-59c2-4f25-aa56-de17021bbc1d"; 11 | # ls /dev/disk/by-id/ 12 | diskID = "ata-ST3250318AS_9VY4EJQV"; 13 | in 14 | { 15 | imports = 16 | [ 17 | 18 | ./remote_i3.nix 19 | ]; 20 | 21 | nixpkgs.system = "x86_64-linux"; 22 | 23 | nixpkgs.config.packageOverrides = pkgs: rec { 24 | qjackctl = pkgs.lib.overrideDerivation pkgs.qjackctl (oldAttrs: { 25 | configureFlags = "--enable-jack-version --disable-xunique"; # fix bug for remote running 26 | }); 27 | # libjack2 = libjack2Unstable; 28 | # faust = faust2unstable; 29 | }; 30 | 31 | environment.systemPackages = [ 32 | qmidinet 33 | qjackctl 34 | jack2 35 | a2jmidid 36 | ]; 37 | 38 | systemd.services.qmidinet = { 39 | description = "Qmidinet"; 40 | enable = true; 41 | environment = { DISPLAY = "2.2.2.1:0"; }; 42 | # environment = { DISPLAY = ":${toString config.services.xserver.display}"; }; 43 | serviceConfig = { 44 | # Type = "simple"; 45 | ExecStart = "${pkgs.qmidinet}/bin/qmidinet -i enp0s18f2u4"; 46 | KillSignal = "SIGUSR2"; 47 | Restart = "always"; 48 | }; 49 | wantedBy = [ "graphical.target" ]; 50 | after = [ "display-manager.service" ]; 51 | # after = [ "network-online.target" ]; 52 | }; 53 | 54 | # hardware.opengl.extraPackages = [ pkgs.vaapiIntel ]; 55 | 56 | services = { 57 | xserver = { 58 | # autorun = false; 59 | # videoDrivers = [ intel ]; 60 | # displayManager = { 61 | # sessionCommands = '' 62 | # xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync 63 | # xrandr --addmode VGA1 1920x1080_60.00 64 | # xrandr --output VGA1 --mode 1920x1080_60.00 65 | # ''; 66 | # }; 67 | windowManager.remote_i3.enable = true; 68 | windowManager.remote_i3.extraSessionCommands = '' 69 | xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync 70 | xrandr --addmode VGA-0 1920x1080_60.00 71 | xrandr --output VGA-0 --mode 1920x1080_60.00 72 | ''; 73 | 74 | windowManager.i3.enable = true; 75 | windowManager.default = "remote_i3"; 76 | }; 77 | smartd = { 78 | enable = true; 79 | devices = [ 80 | { device = "/dev/sda"; } 81 | # { device = "/dev/nvme0n1"; } 82 | # { device = "/dev/sdb"; } 83 | ]; 84 | notifications.test = true; 85 | notifications.x11.enable = true; 86 | 87 | }; 88 | compton = { 89 | enable = true; 90 | # time compton --config /dev/null --backend glx --benchmark 100 91 | # time compton --config /dev/null --backend xrender --benchmark 100 92 | backend = "glx"; 93 | }; 94 | }; 95 | 96 | boot = 97 | { 98 | # dependant on amount of ram: 99 | tmpOnTmpfs = false; 100 | loader.grub.device = "/dev/disk/by-id/${diskID}"; 101 | #loader.grub.extraEntries = import ./extraGrub.nix; 102 | #copy from /etc/nixos/hardware-configuration.nix 103 | initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ata_piix" "usb_storage" ]; 104 | kernelModules = [ ]; 105 | extraModulePackages = [ ]; 106 | blacklistedKernelModules = [ "snd_hda_intel" ]; 107 | }; 108 | 109 | fileSystems = 110 | { 111 | "/" = 112 | { 113 | device = "/dev/disk/by-uuid/${rootUUID}"; 114 | fsType = "ext4"; 115 | options = [ "relatime" "errors=remount-ro" ]; 116 | }; 117 | #"/boot" = 118 | #{ device = "/dev/disk/by-uuid/${bootUUID}"; 119 | # fsType = "ext4"; 120 | # options = [ "relatime" "errors=remount-ro" ]; 121 | #}; 122 | "/home" = 123 | { 124 | device = "/dev/disk/by-uuid/${homeUUID}"; 125 | fsType = "ext4"; 126 | options = [ "relatime" "errors=remount-ro" ]; 127 | }; 128 | }; 129 | 130 | swapDevices = [{ 131 | device = "/dev/disk/by-uuid/${swapUUID}"; 132 | }]; 133 | 134 | nix = { 135 | requireSignedBinaryCaches = true; 136 | maxJobs = 0; # force remote building 137 | distributedBuilds = true; 138 | buildMachines = [{ hostName = "2.2.2.2"; maxJobs = 4; sshKey = "/root/.ssh/id_rsa"; sshUser = "root"; system = "x86_64-linux"; }]; 139 | binaryCaches = [ "http://2.2.2.2:5000/" "https://cache.nixos.org" ]; 140 | binaryCachePublicKeys = [ "mixos:4IOWERw6Xcjocz9vQU5+qK7blTaeOB8QpDjLs0xcUFo=" ]; 141 | }; 142 | 143 | networking = { 144 | interfaces.enp63s0 = { 145 | ipAddress = "2.2.2.1"; 146 | prefixLength = 24; 147 | }; 148 | wireless.enable = false; 149 | }; 150 | } 151 | -------------------------------------------------------------------------------- /machines/nix14/machine.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; 3 | { 4 | boot.loader.systemd-boot.memtest86.enable = true; 5 | 6 | nixpkgs.config.packageOverrides = pkgs: { 7 | vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; 8 | }; 9 | hardware.opengl = { 10 | enable = true; 11 | extraPackages = with pkgs; [ 12 | vaapiIntel 13 | vaapiVdpau 14 | libvdpau-va-gl 15 | intel-media-driver 16 | ]; 17 | }; 18 | 19 | # This value determines the NixOS release with which your system is to be 20 | # compatible, in order to avoid breaking some software such as database 21 | # servers. You should change this only after NixOS release notes say you 22 | # should. 23 | 24 | system.stateVersion = "18.09"; # Did you read the comment? 25 | 26 | hardware.enableAllFirmware = true; 27 | 28 | # hardware.trackpoint = { 29 | # enable = true; 30 | # emulateWheel = true; 31 | # speed = 250; 32 | # sensitivity = 140; 33 | # }; 34 | networking = { 35 | networkmanager.enable = true; 36 | # networkmanager.packages = [ pkgs.networkmanagerapplet ]; 37 | # for zfs: 38 | # head -c 8 /etc/machine-id 39 | hostId = "3a7c3b31"; 40 | # todo: 41 | # building '/nix/store/rhkg61pmzdgng5iyzrz9rhs46cbhj4nl-unit-systemd-fsck-.service.drv'... 42 | # building '/nix/store/kyivxwz1h7xfjnbv321gzb4dypidz7s4-unit-systemd-modules-load.service.drv'... 43 | # building '/nix/store/59r03d91m450gbd48ii8rxwyrszcnqa0-unit-systemd-udevd.service.drv'... 44 | # building '/nix/store/i8idaxgsdf3z6m0ksgnigpy8hmcgasxk-unit-zfs-import.target.drv'... 45 | # building '/nix/store/i8246qj9m41ildw2lz3fsvz0j08778y8-unit-zfs-mount.service.drv'... 46 | # building '/nix/store/hvaqb5i86rjwqy0qy8q76vk4jxzjrg6v-unit-zfs-share.service.drv'... 47 | # building '/nix/store/6a2396ymy7s46lpv68k1xjdx85ssa2a7-unit-zfs-zed.service.drv'... 48 | # autoreconf: running: aclocal --force -I config 49 | # building '/nix/store/748bfspmbp63f9kb63h43qybp6mnzj1s-unit-zfs.target.drv'... 50 | # building '/nix/store/1p1z8y5lxrwgls1zk8rxnig2v8qmqdv3-unit-zpool-trim.service.drv'... 51 | # building '/nix/store/243cynl59yvqh5g6nb72zawf0f01nilq-unit-zpool-trim.timer.drv'... 52 | 53 | # connman.enable = true; 54 | # wireless.enable = true; 55 | }; 56 | 57 | services = { 58 | xserver = { 59 | # videoDrivers = [ "intel" ]; 60 | # windowManager.remote_i3.enable = true; 61 | windowManager.i3 = { 62 | enable = true; 63 | # extraSessionCommands = "{pkgs.physlock}/bin/physlock -ds"; 64 | }; 65 | windowManager.leftwm = { 66 | enable = true; 67 | # extraSessionCommands = "{pkgs.physlock}/bin/physlock -ds"; 68 | }; 69 | displayManager = { 70 | defaultSession = "none+i3"; 71 | # # disable middle mouse buttons 72 | # sessionCommands = '' 73 | # xinput set-button-map 10 1 0 3 && 74 | # xinput set-button-map 11 1 0 3 && 75 | # physlock -ds 76 | # ''; 77 | }; 78 | }; 79 | 80 | smartd = { 81 | enable = true; 82 | devices = [ 83 | # { device = "/dev/sda"; } 84 | { device = "/dev/nvme0n1"; } 85 | # { device = "/dev/sdb"; } 86 | ]; 87 | notifications.test = true; 88 | notifications.x11.enable = true; 89 | }; 90 | 91 | ntp.enable = false; 92 | chrony.enable = true; 93 | 94 | thinkfan = { 95 | enable = true; 96 | smartSupport = true; 97 | sensors = 98 | [ 99 | { 100 | query = "/proc/acpi/ibm/thermal"; 101 | type = "tpacpi"; 102 | # all sensors: 103 | # indices = [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]; 104 | # the sensors we want; gives wonky readouts: 105 | # indices = [ 0 2 4 5 6 ]; 106 | # working: 107 | indices = [ 0 1 2 3 4 5 6 ]; 108 | } 109 | # { 110 | # query = "/sys/class/hwmon/hwmon4/"; 111 | # type = "hwmon"; 112 | # indices = [ 1 ]; 113 | # optional = true; # don't exit if the sensor can't be read 114 | # } 115 | ]; 116 | 117 | levels = [ 118 | [ "level auto" 0 55 ] # normal cooling when we're cold 119 | [ 7 55 65 ] # max 5000 RPM when we're getting hot 120 | [ "level full-speed" 65 32767 ] # max 6700 RPM when we're hot, above fan spec! 121 | ]; 122 | }; 123 | 124 | picom = { 125 | # we start it as needed, config in dotfiles 126 | # enable = true; 127 | # time compton --config /dev/null --backend glx --benchmark 100 128 | # time compton --config /dev/null --backend xrender --benchmark 100 129 | # the above gives xrender as the quickest option, but it tears, whereas glx does not 130 | backend = "glx"; 131 | vSync = true; 132 | # vSync = "opengl-swc"; 133 | # vSync = "opengl-oml"; 134 | # extraOptions = "paint-on-overlay = true"; 135 | # settings = "unredir-if-possible = true"; 136 | # settings = "unredir-if-possible = true"; 137 | }; 138 | }; 139 | # boot.kernelParams = [ "acpi_backlight=native" ]; 140 | 141 | # fix graphical glitches in 5.10 kernel? 142 | # https://bugzilla.redhat.com/show_bug.cgi?id=1925346 143 | # boot.kernelParams = [ "i915.mitigations=off" ]; 144 | # 145 | nix = { 146 | settings = { 147 | max-jobs = 8; 148 | trusted-users = [ "root" "nixBuild" "bart" ]; 149 | # optional, useful when the builder has a faster internet connection than yours 150 | builders-use-substitutes = true; 151 | }; 152 | # hostName = "62.251.18.196"; 153 | buildMachines = [{ 154 | hostName = "builder"; 155 | maxJobs = 24; 156 | # buildCores = 6; 157 | sshKey = "/root/.ssh/id_nixBuild"; 158 | sshUser = "nixBuild"; 159 | system = "x86_64-linux"; 160 | speedFactor = 10; 161 | supportedFeatures = [ 162 | "benchmark" 163 | "big-parallel" 164 | "kvm" 165 | "nixos-test" 166 | ]; 167 | mandatoryFeatures = [ ]; 168 | }]; 169 | }; 170 | 171 | boot = { 172 | 173 | loader.systemd-boot = { 174 | enable = true; 175 | # consoleMode = "max"; 176 | # memtest86.enable = true; # unfree 177 | # }; 178 | loader.efi.canTouchEfiVariables = true; 179 | kernelModules = [ "acpi_call" ]; 180 | extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; 181 | }; 182 | 183 | 184 | } 185 | -------------------------------------------------------------------------------- /machines/nixframe/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; { 3 | imports = [ 4 | ./hardware-configuration.nix 5 | # 6 | # machine specific: 7 | ./machine.nix 8 | # on every machine: 9 | ../../common.nix 10 | # non realtime: 11 | ../../commonNonRT.nix 12 | # music tweaks and progs: 13 | ../../music.nix 14 | ]; 15 | 16 | networking = { hostName = "nixframe"; }; 17 | 18 | services = { 19 | tlp = { 20 | enable = true; 21 | settings = { 22 | START_CHARGE_THRESH_BAT0 = "70"; 23 | STOP_CHARGE_THRESH_BAT0 = "90"; 24 | CPU_SCALING_GOVERNOR_ON_AC = "powersave"; 25 | CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; 26 | CPU_BOOST_ON_AC = "1"; 27 | CPU_BOOST_ON_BAT = "0"; 28 | CPU_HWP_DYN_BOOST_ON_AC = "1"; 29 | CPU_HWP_DYN_BOOST_ON_BAT = "0"; 30 | CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance"; 31 | CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; 32 | PCIE_ASPM_ON_AC = "default"; 33 | PCIE_ASPM_ON_BAT = "powersupersave"; 34 | # INTEL_GPU_MIN_FREQ_ON_AC = "300"; 35 | INTEL_GPU_MIN_FREQ_ON_BAT = "100"; 36 | # INTEL_GPU_MAX_FREQ_ON_AC = "1300"; 37 | INTEL_GPU_MAX_FREQ_ON_BAT = "300"; 38 | # INTEL_GPU_BOOST_FREQ_ON_AC = "1300"; 39 | INTEL_GPU_BOOST_FREQ_ON_BAT = "300"; 40 | 41 | ENERGY_PERF_POLICY_ON_BAT = "powersave"; 42 | # DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE = "wifi"; 43 | DEVICES_TO_DISABLE_ON_LAN_CONNECT = "wifi"; 44 | DEVICES_TO_ENABLE_ON_LAN_DISCONNECT = "wifi"; 45 | 46 | # Enable audio power saving for Intel HDA, AC97 devices (timeout in secs). 47 | # A value of 0 disables, >= 1 enables power saving. 48 | # Note: 1 is recommended for Linux desktop environments with PulseAudio, 49 | # systems without PulseAudio may require 10. 50 | # Default: 1 51 | 52 | SOUND_POWER_SAVE_ON_AC = "0"; 53 | SOUND_POWER_SAVE_ON_BAT = "1"; 54 | # Disable controller too (HDA only): Y/N. 55 | # Note: effective only when SOUND_POWER_SAVE_ON_AC/BAT is activated. 56 | # Default: Y 57 | # SOUND_POWER_SAVE_CONTROLLER = "N"; 58 | # USB_EXCLUDE_PHONE = "1"; 59 | # not needed because of https://github.com/NixOS/nixos-hardware/commit/bf212c4ef57b100c97735a210a3895d3dcc69aa9 60 | # USB_DENYLIST="0bda:8156"; 61 | }; 62 | }; 63 | thermald = { 64 | enable = true; 65 | # configFile = builtins.toFile "thermal-conf.xml" '' 66 | # 67 | # 68 | # 69 | # 70 | # Auto generated 71 | # Laptop (12th Gen Intel Core) 72 | # QUIET 73 | # 74 | # 0 75 | # 5000 76 | # 30000 77 | # 30000 78 | # 30000 79 | # 100 80 | # 81 | # 82 | # 83 | # auto_zone_0 84 | # 85 | # 86 | # SEN3 87 | # 45000 88 | # Passive 89 | # 90 | # B0D4 91 | # 3 92 | # 15000000 93 | # 94 | # 95 | # 96 | # SEN3 97 | # 75000 98 | # Passive 99 | # 100 | # B0D4 101 | # 3 102 | # 15000000 103 | # 104 | # 105 | # 106 | # SEN3 107 | # 78000 108 | # Passive 109 | # 110 | # B0D4 111 | # 3 112 | # 12000000 113 | # 114 | # 115 | # 116 | # SEN3 117 | # 80000 118 | # Passive 119 | # 120 | # B0D4 121 | # 3 122 | # 10000000 123 | # 124 | # 125 | # 126 | # SEN3 127 | # 85000 128 | # Passive 129 | # 130 | # B0D4 131 | # 3 132 | # 133 | # 134 | # 135 | # 136 | # 137 | # auto_zone_1 138 | # 139 | # 140 | # SEN5 141 | # 90000 142 | # Passive 143 | # 144 | # B0D4 145 | # 3 146 | # 147 | # 148 | # 149 | # 150 | # 151 | # 152 | # 153 | # ''; 154 | }; 155 | }; 156 | # hardware.pulseaudio.enable = true; 157 | 158 | # boot.kernelPackages = pkgs.linuxPackages_6_16; 159 | # boot.kernelPackages = pkgs.linuxPackages_latest; 160 | # boot.kernelPackages = pkgs.linuxPackages_testing; 161 | 162 | musnix = { 163 | # enable = true; 164 | # kernel.optimize = true; 165 | # kernel.realtime = true; 166 | rtirq.nameList = "rtc0 usb"; 167 | }; 168 | 169 | # /nix/var/nix/profiles/system-profiles/rt/sw/lib/lv2 170 | environment.variables = { 171 | DSSI_PATH = 172 | "$HOME/.dssi:$HOME/.nix-profile/lib/dssi:/run/current-system/sw/lib/dssi"; 173 | LADSPA_PATH = 174 | "$HOME/.ladspa:$HOME/.nix-profile/lib/ladspa:/run/current-system/sw/lib/ladspa"; 175 | LV2_PATH = 176 | "$HOME/.lv2:$HOME/.nix-profile/lib/lv2:/run/current-system/sw/lib/lv2"; 177 | LXVST_PATH = 178 | "$HOME/.lxvst:$HOME/.nix-profile/lib/lxvst:/run/current-system/sw/lib/lxvst"; 179 | VST_PATH = 180 | "$HOME/.vst:$HOME/.nix-profile/lib/vst:/run/current-system/sw/lib/vst"; 181 | }; 182 | 183 | 184 | # environment.sessionVariables = { 185 | # NIXOS_CONFIG = "/home/bart/nixosConfig/machines/nix14/default.nix"; 186 | # }; 187 | } 188 | -------------------------------------------------------------------------------- /machines/thinknix/machine.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; 3 | 4 | let 5 | # ls /dev/disk/by-id/ 6 | diskID = "ata-INTEL_SSDSA2BW160G3L_BTPR152201YW160DGN"; 7 | # blkid 8 | bootUUID = "32FC-293A"; 9 | in 10 | { 11 | imports = [ 12 | 13 | 14 | 15 | # ./remote_i3.nix 16 | ]; 17 | 18 | nixpkgs.system = "x86_64-linux"; 19 | 20 | hardware = { 21 | opengl.extraPackages = with pkgs; [ vaapiIntel libvdpau-va-gl vaapiVdpau ]; 22 | trackpoint = { 23 | enable = true; 24 | sensitivity = 200; 25 | speed = 100; 26 | emulateWheel = true; 27 | }; 28 | }; 29 | 30 | sound.extraConfig = '' 31 | pcm.!default { 32 | type rate 33 | slave { 34 | pcm "hw:0" 35 | rate 44100 36 | } 37 | } 38 | ''; 39 | 40 | boot = { 41 | # dependant on amount of ram: 42 | # tmpOnTmpfs = true; 43 | # loader.grub.device = "/dev/disk/by-id/${diskID}"; 44 | #loader.grub.extraEntries = import ./extraGrub.nix; 45 | # workaround for kernel bug https://bbs.archlinux.org/viewtopic.php?id=218581&p=3 46 | # kernelPackages = pkgs.linuxPackages_4_4; 47 | initrd.availableKernelModules = [ 48 | #copy from /etc/nixos/hardware-configuration.nix 49 | "ehci_pci" 50 | "ahci" 51 | "usb_storage" 52 | "sd_mod" 53 | "sr_mod" 54 | "sdhci_pci" 55 | ]; 56 | # kernelModules = [ "kvm-intel" ]; # for virtualisation 57 | kernelModules = [ "acpi_call" "tp_smapi" ]; 58 | extraModprobeConfig = '' 59 | options 60 | iwlwifi 61 | power_save=1 62 | d0i3_disable=0 63 | uapsd_disable=0 64 | ''; 65 | extraModulePackages = [ 66 | config.boot.kernelPackages.acpi_call 67 | config.boot.kernelPackages.tp_smapi 68 | ]; 69 | kernelParams = [ 70 | "fastboot=true" 71 | # Kernel GPU Savings Options (NOTE i915 chipset only) 72 | "drm.debug=0" 73 | "drm.vblankoffdelay=1" 74 | "nmi_watchdog=0" 75 | # handle screen brightness manually, so we can go lower: 76 | "video.brightness_switch_enabled=0" 77 | "quiet" 78 | ]; 79 | blacklistedKernelModules = [ 80 | # Kernel GPU Savings Options (NOTE i915 chipset only) 81 | "sierra_net" 82 | "cdc_mbim" 83 | "cdc_ncm" 84 | "btusb" 85 | # disable beep 86 | "snd_pcsp" 87 | "pcspkr" 88 | #disable webcam 89 | "uvcvideo" 90 | ]; 91 | }; 92 | 93 | # powerManagement.cpuFreqGovernor = "powersave"; 94 | 95 | fileSystems = { 96 | "/" = { 97 | device = "/dev/mapper/VolGroup-nixos"; 98 | fsType = "ext4"; 99 | options = [ "relatime" "errors=remount-ro" "discard" ]; 100 | }; 101 | "/boot" = { 102 | device = "/dev/disk/by-uuid/${bootUUID}"; 103 | # fsType = "vfat"; 104 | # options = [ "relatime" "errors=remount-ro" ]; 105 | }; 106 | "/home" = { 107 | device = "/dev/mapper/VolGroup-home"; 108 | fsType = "ext4"; 109 | options = [ "relatime" "errors=remount-ro" "discard" ]; 110 | }; 111 | }; 112 | 113 | swapDevices = [{ device = "/dev/mapper/VolGroup-swap"; }]; 114 | 115 | nix = { 116 | requireSignedBinaryCaches = true; 117 | # maxJobs = 0; # 0 = force remote building. if the server is down, add "--maxJobs 4" to wour build command to temporarily force a local build again. 118 | # distributedBuilds = true; 119 | # buildMachines = [ { hostName = "buildbox"; maxJobs = 4; sshKey = "/home/bart/.ssh/github_rsa"; sshUser = "root"; system = "x86_64-linux"; supportedFeatures = [ "big-parallel" ]; buildCores = 0; } ]; 120 | 121 | # buildMachines = [ { hostName = "10.205.12.40"; maxJobs = 12; sshKey = "/home/bart/.ssh/github_rsa"; sshUser = "root"; system = "x86_64-linux"; supportedFeatures = [ "big-parallel" ]; buildCores = 0; } ]; 122 | # buildMachines = [ { hostName = "10.205.25.89"; maxJobs = 4; sshKey = "/root/.ssh/id_rsa"; sshUser = "root"; system = "x86_64-linux"; } ]; 123 | # buildMachines = [ { hostName = "10.205.12.40"; maxJobs = 12; sshKey = "/root/.ssh/id_rsa"; sshUser = "root"; system = "x86_64-linux"; } ]; 124 | # nix eval nixpkgs.linuxPackages.kernel.requiredSystemFeatures 125 | # buildMachines = [ { hostName = "2.2.2.2"; maxJobs = 4; sshKey = "/root/.ssh/id_rsa"; sshUser = "root"; system = "x86_64-linux"; } ]; 126 | # binaryCaches = [ "https://cache.nixos.org" "https://2.2.2.2:5000/" ]; 127 | binaryCachePublicKeys = [ 128 | "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" 129 | "mixos:4IOWERw6Xcjocz9vQU5+qK7blTaeOB8QpDjLs0xcUFo=" 130 | ]; 131 | # optional, useful when the builder has a faster internet connection than yours 132 | extraOptions = '' 133 | builders-use-substitutes = true 134 | ''; 135 | }; 136 | 137 | networking = { 138 | networkmanager.enable = true; 139 | networkmanager.packages = [ pkgs.networkmanagerapplet ]; 140 | # connman.enable = true; 141 | # wireless.enable = true; 142 | }; 143 | 144 | services = { 145 | xserver = { 146 | videoDrivers = [ "intel" ]; 147 | # windowManager.remote_i3.enable = true; 148 | windowManager.i3 = { 149 | enable = true; 150 | # extraSessionCommands = "{pkgs.physlock}/bin/physlock -ds"; 151 | }; 152 | displayManager = { 153 | defaultSession = "none+i3"; 154 | # # disable middle mouse buttons 155 | # sessionCommands = '' 156 | # xinput set-button-map 10 1 0 3 && 157 | # xinput set-button-map 11 1 0 3 && 158 | # physlock -ds 159 | # ''; 160 | }; 161 | }; 162 | smartd = { 163 | enable = true; 164 | devices = [ 165 | { device = "/dev/sda"; } 166 | # { device = "/dev/nvme0n1"; } 167 | # { device = "/dev/sdb"; } 168 | ]; 169 | notifications.test = true; 170 | notifications.x11.enable = true; 171 | }; 172 | 173 | # liquidsoap.streams = { papillon = ./papillon.liq; }; 174 | 175 | ntp.enable = false; 176 | chrony.enable = true; 177 | 178 | picom = { 179 | # we start it as needed, config in dotfiles 180 | # enable = true; 181 | # time compton --config /dev/null --backend glx --benchmark 100 182 | # time compton --config /dev/null --backend xrender --benchmark 100 183 | # the above gives xrender as the quickest option, but it tears, whereas glx does not 184 | backend = "glx"; 185 | vSync = true; 186 | # vSync = "opengl-swc"; 187 | # vSync = "opengl-oml"; 188 | # extraOptions = "paint-on-overlay = true"; 189 | # settings = "unredir-if-possible = true"; 190 | # settings = "unredir-if-possible = true"; 191 | }; 192 | psd = { 193 | # annoying find /home/ "-type d -name *crashrecovery*" at startup 194 | # https://github.com/graysky2/anything-sync-daemon/issues/56 195 | # enable = true; 196 | # users = [ "bart" ]; # At least one is required 197 | # browsers = [ "firefox" ]; # Leave blank to enable all 198 | }; 199 | tlp = { 200 | # enable = true; 201 | extraConfig = '' 202 | CPU_SCALING_GOVERNOR_ON_AC=performance 203 | CPU_SCALING_GOVERNOR_ON_BAT=powersave 204 | CPU_BOOST_ON_AC=1 205 | CPU_BOOST_ON_BAT=0 206 | CPU_MIN_PERF_ON_BAT=0 207 | CPU_MAX_PERF_ON_BAT=0 208 | SCHED_POWERSAVE_ON_AC=0 209 | SCHED_POWERSAVE_ON_BAT=1 210 | NMI_WATCHDOG=0 211 | DISK_DEVICES="$diskID" 212 | DISK_IOSCHED="deadline" 213 | ENERGY_PERF_POLICY_ON_AC=performance 214 | ENERGY_PERF_POLICY_ON_BAT=powersave 215 | PCIE_ASPM_ON_AC=performance 216 | PCIE_ASPM_ON_BAT=powersave 217 | SATA_LINKPWR_ON_AC=max_performance 218 | SATA_LINKPWR_ON_BAT=min_power 219 | WIFI_PWR_ON_AC=off 220 | WIFI_PWR_ON_BAT=on 221 | WOL_DISABLE=Y 222 | SOUND_POWER_SAVE_ON_AC=0 223 | SOUND_POWER_SAVE_ON_BAT=1 224 | SOUND_POWER_SAVE_CONTROLLER=Y 225 | BAY_POWEROFF_ON_BAT=1 226 | BAY_DEVICE=sr0 227 | RUNTIME_PM_ON_AC=on 228 | RUNTIME_PM_ON_BAT=auto 229 | USB_AUTOSUSPEND=1 230 | USB_BLACKLIST_WWAN=0 231 | # not implemented yet in current release: 232 | USB_BLACKLIST_PHONE=1 233 | # workaround: 234 | # USB_BLACKLIST="05ac:12a0" 235 | DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wwan" 236 | # Radio devices to disable on connect. 237 | DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan" 238 | DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan" 239 | DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi" 240 | # Radio devices to enable on disconnect. 241 | DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi" 242 | DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT="" 243 | DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT="" 244 | START_CHARGE_THRESH_BAT0=35 245 | STOP_CHARGE_THRESH_BAT0=85 246 | ''; 247 | }; 248 | thinkfan = { 249 | enable = true; 250 | sensors = '' 251 | hwmon /sys/devices/virtual/thermal/thermal_zone0/temp 252 | hwmon /sys/devices/virtual/thermal/thermal_zone1/temp 253 | hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input 254 | hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp2_input 255 | hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp3_input 256 | ''; 257 | }; 258 | # thinkfan.enable = true; 259 | # run strace tlp-stat -t 260 | # thinkfan.sensors = "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input"; 261 | 262 | # thinkfan.sensors = "hwmon /sys/devices/virtual/hwmon/hwmon0/temp1_input (0,0,10)"; 263 | # thinkfan.sensors = "hwmon /sys/devices/virtual/thermal/thermal_zone0/temp (0,0,10)"; 264 | 265 | # Suspend the system when battery level drops to 5% or lower 266 | 267 | # SUBSYSTEM=="power_supply",ACTION=change,RUN+="${pkgs.coreutils}/bin/sleep 1 $$ ${pkgs.light}/bin/light -I" 268 | # udev.extraRules = '' 269 | # SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_STATUS}=="Unknown", RUN+="${pkgs.coreutils}/bin/mktemp -t "ttestung.XXXXXXXXXX" 270 | # ''; 271 | # udev.extraRules = '' 272 | # SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="${pkgs.systemd}/bin/systemctl hibernate" 273 | # SUBSYSTEM=="power_supply", ACTION=="change", \ 274 | # OPTIONS+="last_rule", \ 275 | # RUN+=" ${pkgs.light}/bin/light -I" 276 | # ''; 277 | }; 278 | 279 | # something like this should enable lower backlight, making ~/.local/bin/brightness.sh and the light save and restore unneeded 280 | # ENV{ID_BACKLIGHT_CLAMP}="0" 281 | # environment.systemPackages = [ tpacpi-bat ]; 282 | 283 | } 284 | -------------------------------------------------------------------------------- /machines/pronix/configuration.nix: -------------------------------------------------------------------------------- 1 | # Edit this configuration file to define what should be installed on 2 | # your system. Help is available in the configuration.nix(5) man page 3 | # and in the NixOS manual (accessible by running ‘nixos-help’). 4 | 5 | { lib 6 | , config 7 | , pkgs 8 | , ... 9 | }: 10 | 11 | { 12 | imports = [ 13 | # Include the results of the hardware scan. 14 | ./hardware-configuration.nix 15 | ]; 16 | 17 | # Use the GRUB 2 boot loader. 18 | boot.loader.grub.enable = true; 19 | boot.loader.grub.copyKernels = true; 20 | # boot.loader.grub.efiSupport = true; 21 | # boot.loader.grub.efiInstallAsRemovable = true; 22 | # boot.loader.efi.efiSysMountPoint = "/boot/efi"; 23 | # Add ZFS support. 24 | boot.supportedFilesystems = [ "zfs" ]; 25 | # head -c 8 /etc/machine-id 26 | networking.hostId = "392d5564"; 27 | # boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; 28 | # Note: If you do partition the disk, make sure you set the disk’s scheduler to none. ZFS takes this step automatically if it does control the entire disk. 29 | # On NixOS, you an set your scheduler to none via: 30 | boot.kernelParams = [ "elevator=none" ]; 31 | #/dev/disk/by-id/wwn-0x5000c5005f5cb3b3"rt- Define on which hard drive you want to install Grub. 32 | boot.loader.grub.devices = [ 33 | # or "nodev" for efi only 34 | # DISK1: swap, if none of the other disks are there, we don't have a system, so no need for a bootloader 35 | # TODO: replace DISK2 with DISK9 after badblocks and long test 36 | #"/dev/disk/by-id/wwn-0x5000c5005ea8da23" # DISK2 DEAD 37 | # "/dev/disk/by-id/wwn-0x5000c500629dc827" # DISK9 SPARE 38 | # "/dev/disk/by-id/wwn-0x5000c5005f5cb3b3" # DISK1 39 | #"/dev/disk/by-id/wwn-0x5000c50068875a67" # DISK3 DEAD 40 | #"/dev/disk/by-id/wwn-0x5000c500688c9f77" # DISK4 DEAD 41 | # "/dev/disk/by-id/wwn-0x5000c500681b817b" # DISK14 DEAD 42 | "/dev/disk/by-id/wwn-0x5000c500684c2f73" # DISK15 43 | # "/dev/disk/by-id/wwn-0x5000c5004be2033b" # DISK16 FAULTED 44 | "/dev/disk/by-id/wwn-0x5000c500681b26fb" # DISK17 45 | "/dev/disk/by-id/wwn-0x5000c500763332ff" # DISK18 46 | ]; 47 | boot.tmp.useTmpfs = true; 48 | networking.hostName = "pronix"; # Define your hostname. 49 | # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. 50 | 51 | # Set your time zone. 52 | time.timeZone = "Europe/Amsterdam"; 53 | 54 | # The global useDHCP flag is deprecated, therefore explicitly set to false here. 55 | # Per-interface useDHCP will be mandatory in the future, so this generated config 56 | # replicates the default behaviour. 57 | networking.useDHCP = false; 58 | networking.interfaces.eno1.useDHCP = true; 59 | networking.interfaces.eno2.useDHCP = true; 60 | networking.interfaces.eno3.useDHCP = true; 61 | networking.interfaces.eno4.useDHCP = true; 62 | 63 | # Configure network proxy if necessary 64 | # networking.proxy.default = "http://user:password@proxy:port/"; 65 | # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; 66 | 67 | # Select internationalisation properties. 68 | # i18n.defaultLocale = "en_US.UTF-8"; 69 | # console = { 70 | # font = "Lat2-Terminus16"; 71 | # keyMap = "us"; 72 | # }; 73 | 74 | # Define a user account. Don't forget to set a password with ‘passwd’. 75 | users = { 76 | defaultUserShell = pkgs.bash; 77 | groups.nixBuild = { }; 78 | users = { 79 | bart = { 80 | isNormalUser = true; 81 | extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. 82 | shell = pkgs.fish; 83 | }; 84 | nixBuild = { 85 | name = "nixBuild"; 86 | isSystemUser = true; 87 | useDefaultShell = true; 88 | openssh.authorizedKeys.keys = [ 89 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID1kJ2pCgAaixNICnm2WB6ILvE7+BTvNTaWPYBOvaXsv nixBuild" 90 | ]; 91 | group = "nixBuild"; 92 | }; 93 | }; 94 | }; 95 | nix.settings = { 96 | allowed-users = [ 97 | "nixBuild" 98 | "@wheel" 99 | ]; 100 | trusted-users = [ "nixBuild" ]; 101 | auto-optimise-store = true; 102 | # https://github.com/NixOS/nix/issues/11728 103 | download-buffer-size = 1073741824; # 1GB 104 | }; 105 | 106 | #virtualisation.virtualbox = 107 | #{ 108 | #host.enable = true; 109 | # guest.enable = true; 110 | #}; 111 | 112 | # List packages installed in system profile. To search, run: 113 | # $ nix search wget 114 | environment = { 115 | systemPackages = with pkgs; [ 116 | # Commandline tools 117 | coreutils 118 | gitFull 119 | parted 120 | man 121 | tmux 122 | thumbs # tmux-thumbs 123 | tree 124 | wget 125 | vim 126 | mkpasswd 127 | pass 128 | gnupg 129 | pinentry-curses 130 | smartmontools 131 | ranger 132 | yazi 133 | lf 134 | joshuto 135 | zoxide 136 | fclones 137 | rmlint 138 | eza 139 | htop 140 | lm_sensors 141 | nix-zsh-completions 142 | nixos-option 143 | nixfmt 144 | speedtest-cli 145 | fzf 146 | skim 147 | bottom 148 | xclip 149 | tealdeer 150 | shellcheck 151 | # doom emacs dependencies 152 | git 153 | emacs 154 | cmake 155 | gnumake 156 | pandoc 157 | haskellPackages.markdown 158 | mu 159 | isync 160 | editorconfig-core-c # per-project style config 161 | gnutls # for TLS connectivity 162 | imagemagickBig # for image-dired 163 | pinentry-emacs # in-emacs gnupg prompts 164 | zstd # for undo-tree compression 165 | aspell 166 | sqlite 167 | nodejs 168 | faust 169 | ripgrep 170 | coreutils # basic GNU utilities 171 | fd 172 | clang 173 | nix-du 174 | nix-tree 175 | 176 | cargo 177 | rustc 178 | 179 | jq 180 | stow 181 | 182 | delta 183 | 184 | lldb # for helix 185 | evil-helix 186 | 187 | ethtool 188 | 189 | # dirname 190 | # 191 | ollama 192 | fish 193 | fclones 194 | nixpkgs-review 195 | ]; 196 | 197 | shells = [ pkgs.zsh ]; 198 | }; 199 | # Some programs need SUID wrappers, can be configured further or are 200 | # started in user sessions. 201 | # programs.mtr.enable = true; 202 | # programs.gnupg.agent = { 203 | # enable = true; 204 | # enableSSHSupport = true; 205 | # }; 206 | 207 | nix.settings.experimental-features = [ 208 | "nix-command" 209 | "flakes" 210 | ]; 211 | 212 | programs = { 213 | zsh.enable = true; 214 | fish.enable = true; 215 | bash = { 216 | enable = true; 217 | interactiveShellInit = '' 218 | if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] 219 | then 220 | shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" 221 | exec ${pkgs.fish}/bin/fish $LOGIN_OPTION 222 | fi 223 | ''; 224 | }; 225 | mosh.enable = true; 226 | 227 | # Mail notification for ZFS Event Daemon: 228 | msmtp = { 229 | enable = true; 230 | setSendmail = true; 231 | defaults = { 232 | aliases = "/etc/aliases"; 233 | port = 465; 234 | tls_trust_file = "/etc/ssl/certs/ca-certificates.crt"; 235 | tls = "on"; 236 | auth = "login"; 237 | tls_starttls = "off"; 238 | }; 239 | accounts = { 240 | default = { 241 | host = "sub5.mail.dreamhost.com"; 242 | passwordeval = "pass mail"; 243 | user = "bart@magnetophon.nl"; 244 | from = "bart@magnetophon.nl"; 245 | }; 246 | }; 247 | }; 248 | gnupg.agent = { 249 | enable = true; 250 | # pinentryFlavor = "curses"; # should be automatic 251 | enableSSHSupport = true; 252 | }; 253 | }; 254 | 255 | # List services that you want to enable: 256 | 257 | services = { 258 | 259 | # Enable the OpenSSH daemon. 260 | openssh = { 261 | enable = true; 262 | ports = [ 511 ]; 263 | settings = { 264 | PasswordAuthentication = false; 265 | PermitRootLogin = "no"; 266 | }; 267 | extraConfig = '' 268 | Match User nixBuild 269 | AllowAgentForwarding no 270 | AllowTcpForwarding no 271 | PermitTTY no 272 | PermitTunnel no 273 | X11Forwarding no 274 | Match All 275 | ClientAliveInterval 300 276 | ClientAliveCountMax 3 277 | TCPKeepAlive yes 278 | ''; 279 | }; 280 | 281 | fail2ban = { 282 | enable = true; 283 | jails.sshd = lib.mkForce '' 284 | enabled = true 285 | filter = sshd 286 | ignoreip = 127.0.0.1/8,192.168.178.1/24 287 | ''; 288 | }; 289 | 290 | smartd = { 291 | enable = true; 292 | }; 293 | 294 | # ZFS services 295 | zfs = { 296 | autoSnapshot.enable = true; 297 | autoScrub = { 298 | enable = true; 299 | interval = "weekly"; 300 | }; 301 | trim.enable = true; 302 | # zed = { 303 | # settings = { 304 | # ZED_DEBUG_LOG = "/tmp/zed.debug.log"; 305 | # ZED_EMAIL_ADDR = [ "root" ]; 306 | # ZED_EMAIL_PROG = "${pkgs.msmtp}/bin/msmtp"; 307 | # ZED_EMAIL_OPTS = "@ADDRESS@"; 308 | 309 | # ZED_NOTIFY_INTERVAL_SECS = 3600; 310 | # ZED_NOTIFY_VERBOSE = true; 311 | 312 | # ZED_USE_ENCLOSURE_LEDS = true; 313 | # ZED_SCRUB_AFTER_RESILVER = true; 314 | # }; 315 | # this option does not work; will return error 316 | # enableMail = false; 317 | # }; 318 | }; 319 | 320 | # Enable the X11 windowing system. 321 | # services.xserver.enable = true; 322 | 323 | # Configure keymap in X11 324 | # services.xserver.layout = "us"; 325 | # services.xserver.xkbOptions = "eurosign:e"; 326 | 327 | # Enable CUPS to print documents. 328 | # services.printing.enable = true; 329 | 330 | # Enable sound. 331 | # sound.enable = true; 332 | # hardware.pulseaudio.enable = true; 333 | 334 | # Enable touchpad support (enabled default in most desktopManager). 335 | # services.xserver.libinput.enable = true; 336 | # emacs = { 337 | # enable = true; 338 | # defaultEditor = true; 339 | # package = pkgs.emacs.override { 340 | # withNativeCompilation = true; 341 | # }; 342 | # }; 343 | # pcscd.enable = true; 344 | }; 345 | 346 | # Enable Wake on LAN 347 | # this service runs before my NW card is ready 348 | # but is still needed for when I wake up from sleep 349 | # see: https://github.com/NixOS/nixpkgs/pull/97362?notification_referrer_id=MDE4Ok5vdGlmaWNhdGlvblRocmVhZDExMzcyNTU1MDI6NzY0NTcxMQ%3D%3D¬ifications_query=is%3Aunread#issuecomment-823307947 350 | # services.wakeonlan.interfaces = [ 351 | # { interface = "eno1"; method = "magicpacket"; } 352 | # ]; 353 | networking.interfaces.eno1.wakeOnLan = { 354 | enable = true; 355 | # method = "magicpacket"; 356 | }; 357 | # this covers the rest of the cases 358 | systemd.services.wol-eth0 = { 359 | description = "Wake-on-LAN for eno1"; 360 | requires = [ "network.target" ]; 361 | after = [ "network.target" ]; 362 | wantedBy = [ "multi-user.target" ]; 363 | serviceConfig = { 364 | Type = "oneshot"; 365 | ExecStart = "${pkgs.ethtool}/bin/ethtool -s eno1 wol g"; # magicpacket 366 | }; 367 | }; 368 | 369 | # Open ports in the firewall. 370 | # networking.firewall.allowedTCPPorts = [ ... ]; 371 | # networking.firewall.allowedUDPPorts = [ ... ]; 372 | # Or disable the firewall altogether. 373 | # networking.firewall.enable = false; 374 | 375 | # This value determines the NixOS release from which the default 376 | # settings for stateful data, like file locations and database versions 377 | # on your system were taken. It‘s perfectly fine and recommended to leave 378 | # this value at the release version of the first install of this system. 379 | # Before changing this value read the documentation for this option 380 | # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). 381 | system.stateVersion = "20.09"; # Did you read the comment? 382 | 383 | } 384 | -------------------------------------------------------------------------------- /music.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | bandithedoge, 5 | ... 6 | }: 7 | with pkgs; 8 | { 9 | 10 | # make sure you do: 11 | # users.extraUsers.bart.extraGroups = [ "wheel" "audio" ]; 12 | # set: 13 | # soundcardPciId 14 | # rtirq.nameList 15 | 16 | # imports = [ 17 | # Include musnix: a meta-module for realtime audio. 18 | # todo: make submodule 19 | # /home/bart/source/musnix/default.nix 20 | # ]; 21 | 22 | musnix = { 23 | # enable = true; 24 | rtirq.highList = "snd_hrtimer"; 25 | rtirq.resetAll = 1; 26 | rtirq.prioLow = 0; 27 | alsaSeq.enable = false; 28 | }; 29 | 30 | nixpkgs = { 31 | config.packageOverrides = pkgs: rec { 32 | guitarix = pkgs.guitarix.override { optimizationSupport = true; }; # TODO: upstream 33 | pd_plugins = [ 34 | helmholtz 35 | timbreid 36 | maxlib 37 | zexy 38 | puremapping 39 | cyclone 40 | mrpeach 41 | ]; 42 | # plugins = [ helmholtz timbreid maxlib zexy cyclone mrpeach ]; 43 | fullPD = puredata-with-plugins pd_plugins; 44 | qjackctl = pkgs.lib.overrideDerivation pkgs.qjackctl (oldAttrs: { 45 | configureFlags = "--enable-jack-version --disable-xunique"; # fix bug for remote running 46 | }); 47 | 48 | }; 49 | 50 | # overlays = lib.singleton (lib.const (super: { 51 | # linuxPackages_4_19_rt = super.linuxPackages_4_19_rt.extend (lib.const (ksuper: { 52 | # kernel = ksuper.kernel.override { 53 | # structuredExtraConfig = 54 | # with import (pkgs.path + "/lib/kernel.nix") 55 | # {inherit lib; version = "4.19.75"; }; 56 | # { 57 | # PREEMPT_VOLUNTARY = lib.mkForce no; 58 | # HUGETLB_PAGE = yes; 59 | # TRANSPARENT_HUGEPAGE_ALWAYS = yes; 60 | # }; 61 | # }; 62 | # })); 63 | # })); 64 | }; 65 | 66 | # nixpkgs.overlays = [ 67 | # (self: super: { 68 | # faust = super.faust.overrideAttrs (old: rec { 69 | # version = "2.81.10"; 70 | 71 | # src = super.fetchFromGitHub { 72 | # owner = "grame-cncm"; 73 | # repo = "faust"; 74 | # tag = version; 75 | # hash = "sha256-xmaZY1jFIZQjWlQkJ+uHC4tY4pFPLJ+fKSbktIZkBFI="; 76 | # fetchSubmodules = true; 77 | # }; 78 | # }); 79 | # }) 80 | # ]; 81 | 82 | environment = { 83 | systemPackages = [ 84 | # ################################################################# 85 | # plugins # 86 | ################################################################### 87 | airwin2rack 88 | airwindows 89 | airwindows-lv2 90 | # foo-yc20 https://github.com/sampov2/foo-yc20/issues/7 91 | AMB-plugins 92 | fil-plugins 93 | adlplug 94 | aeolus 95 | aether-lv2 96 | artyFX 97 | x42-avldrums 98 | bchoppr 99 | bespokesynth 100 | bjumblr 101 | bristol 102 | bsequencer 103 | bshapr 104 | bslizr 105 | bschaffl 106 | bjumblr 107 | bchoppr 108 | bolliedelayxt-lv2 109 | calf 110 | caps 111 | cardinal 112 | chow-kick 113 | chow-phaser 114 | chow-tape-model 115 | chow-centaur 116 | csa 117 | cmt 118 | diopser 119 | distrho-ports 120 | dragonfly-reverb 121 | drumgizmo 122 | drumkv1 123 | ensemble-chorus 124 | eq10q 125 | fire 126 | 127 | # nur-bandithedoge.resonarium-bin 128 | # nur-bandithedoge.presswerk 129 | # nur.repos.mic92.hello-nur 130 | # nur.repos.bandithedoge.u-he.presswerk 131 | # pkgs.u-he.presswerk 132 | bandithedoge.legacyPackages.${pkgs.system}.u-he.presswerk 133 | 134 | open-music-kontrollers.eteroj 135 | open-music-kontrollers.jit 136 | open-music-kontrollers.mephisto 137 | open-music-kontrollers.midi_matrix 138 | open-music-kontrollers.moony 139 | open-music-kontrollers.orbit 140 | open-music-kontrollers.patchmatrix 141 | open-music-kontrollers.router 142 | open-music-kontrollers.sherlock 143 | open-music-kontrollers.synthpod 144 | open-music-kontrollers.vm 145 | 146 | fluidsynth 147 | fomp 148 | freqtweak 149 | fverb 150 | geonkick 151 | ripplerx 152 | melmatcheq-lv2 153 | gxmatcheq-lv2 154 | gxplugins-lv2 155 | helm 156 | hybridreverb2 157 | hydrogen 158 | industrializer 159 | infamousPlugins 160 | # ingen 161 | ir.lv2 162 | jaaa 163 | jack_oscrolloscope 164 | jackmeter 165 | jack-example-tools 166 | japa 167 | ladspaH 168 | ladspaPlugins 169 | lsp-plugins 170 | librearp 171 | librearp-lv2 172 | mda_lv2 173 | molot-lite 174 | ctagdrc 175 | mod-arpeggiator-lv2 176 | ninjas2 177 | noise-repellent 178 | nova-filters 179 | odin2 180 | oxefmsynth 181 | padthv1 182 | quadrafuzz 183 | plugin-torture 184 | pluginval 185 | qsampler 186 | qsynth 187 | # rc-effect-playground # https://github.com/jpcima/rc-effect-playground/issues/4 188 | rkrlv2 189 | samplv1 190 | setbfree 191 | sfizz # pro sampler 192 | sorcer 193 | spectmorph 194 | speech-denoiser 195 | stochas 196 | stone-phaser 197 | master_me 198 | string-machine 199 | swh_lv2 200 | synthv1 201 | surge 202 | surge-XT 203 | vaporizer2 204 | tamgamp.lv2 205 | tetraproc 206 | uhhyou-plugins 207 | uhhyou-plugins-juce 208 | vocproc 209 | wolf-shaper 210 | x42-plugins 211 | yoshimi 212 | zam-plugins 213 | zlcompressor 214 | zlequalizer 215 | zlsplitter 216 | zynaddsubfx 217 | ################################################################### 218 | # faust # 219 | ################################################################### 220 | 221 | magnetophonDSP.MBdistortion # ERROR : path '/MBdistortion/frequency_bands/low/Drive' is already used 222 | magnetophonDSP.CharacterCompressor 223 | # magnetophonDSP.CompBus # long build, not used 224 | magnetophonDSP.ConstantDetuneChorus 225 | magnetophonDSP.LazyLimiter 226 | magnetophonDSP.RhythmDelay 227 | magnetophonDSP.VoiceOfFaust 228 | magnetophonDSP.faustCompressors 229 | magnetophonDSP.pluginUtils 230 | magnetophonDSP.shelfMultiBand 231 | tambura 232 | faust 233 | faust2alqt 234 | faust2alsa 235 | faust2firefox 236 | faust2jack 237 | faust2jackrust 238 | faust2jaqt 239 | faust2lv2 240 | faustlive 241 | kapitonov-plugins-pack 242 | mooSpace 243 | 244 | ################################################################### 245 | # hosts # 246 | ################################################################### 247 | 248 | ardour 249 | xjadeo 250 | helio-workstation 251 | carla 252 | audacity 253 | jalv 254 | mod-distortion 255 | petrifoo 256 | guitarix 257 | zrythm 258 | # i-score #error: Package ‘JamomaCore-1.0-beta.1’ in /nix/store/0grkglhhrfiy27sdhmpwsryid5hw9qnz-nixos-20.03pre212208.8130f3c1c2b/nixos/pkgs/development/libraries/audio/jamomacore/default.nix:18 is marked as broken, refusing to evaluate. 259 | bitwig-studio 260 | reaper 261 | ################################################################### 262 | # utilities # 263 | ################################################################### 264 | a2jmidid 265 | cuetools 266 | jack2 267 | jack-link 268 | # jack1 269 | # jack_capture 270 | lilv 271 | lv2bm 272 | mamba 273 | qjackctl 274 | sonic-lineup 275 | vmpk 276 | qmidinet 277 | ################################################################### 278 | # analizers # 279 | ################################################################### 280 | squishyball 281 | shntool 282 | ################################################################### 283 | # converters # 284 | ################################################################### 285 | flac 286 | lame 287 | sox 288 | ################################################################### 289 | # various # 290 | ################################################################### 291 | polyphone # soundfont / sfz editor 292 | dfasma 293 | freewheeling 294 | # gigedit 295 | MMA 296 | #latencytop 297 | mixxx 298 | # pkgs.puredata-with-plugins.override { plugins = [ helmholtz timbreid maxlib puremapping zexy cyclone mrpeach ]; } 299 | fullPD 300 | real_time_config_quick_scan 301 | # supercollider_scel 302 | (pkgs.fmit.override { jackSupport = true; }) 303 | sooperlooper 304 | vimpc # A vi/vim inspired client for the Music Player Daemon (mpd) 305 | ################################################################### 306 | # develpoment # 307 | ################################################################### 308 | octave 309 | graphviz 310 | leiningen 311 | ladspa-sdk 312 | # nur-bandithedoge.hvcc 313 | ################################################################### 314 | # unfree # 315 | ################################################################### 316 | x32edit 317 | # m32edit # unfree 318 | # reaper # unfree 319 | # sunvox # unfree 320 | # airwave # VST bridge # unfree 321 | # linuxsampler # unfree 322 | # vcv-rack # unfree 323 | # vital # unfree 324 | 325 | ]; 326 | }; 327 | 328 | systemd.services = { 329 | # jack = { 330 | # after = [ "sound.target" ]; 331 | # description = "Jack audio server"; 332 | # wantedBy = [ "multi-user.target" ]; 333 | # serviceConfig = { 334 | # LimitRTPRIO = "infinity"; 335 | # LimitMEMLOCK = "infinity"; 336 | # Environment="JACK_NO_AUDIO_RESERVATION=1"; 337 | # ExecStart = '' 338 | # ${pkgs.jack2}/bin/jackd -P71 -p1024 -dalsa -dhw:0 -r44100 -n2 339 | # ''; 340 | # User = "bart"; 341 | # Group = "audio"; 342 | # KillSignal="SIGKILL"; 343 | # Restart="always"; 344 | # # ExecStartPre="${pkgs.pulseaudio}/bin/pulseaudio -k"; 345 | # }; 346 | # }; 347 | 348 | # papillon = { 349 | # after = [ "network-online.target" "jack.service" ]; 350 | # description = "Papillon liquidsoap stream"; 351 | # # wantedBy = [ "multi-user.target" ]; 352 | # path = [ pkgs.wget ]; 353 | # preStart = '' 354 | # mkdir -p /var/log/liquidsoap 355 | # chown bart -R /var/log/liquidsoap 356 | # ''; 357 | # serviceConfig = { 358 | # LimitRTPRIO = "infinity"; 359 | # LimitMEMLOCK = "infinity"; 360 | # PermissionsStartOnly="true"; 361 | # ExecStart = "${pkgs.liquidsoap}/bin/liquidsoap /home/bart/source/nixradio/papillon.liq"; 362 | # User = "bart"; 363 | # Group = "audio"; 364 | # KillSignal="SIGKILL"; 365 | # Restart="always"; 366 | # }; 367 | # }; 368 | 369 | # tunnel = { 370 | # after = [ "network.target" ]; 371 | # description = "Creates a public reverse tunnel from a server to a port of this computer."; 372 | # wantedBy = [ "multi-user.target" ]; 373 | # serviceConfig = { 374 | # Environment="AUTOSSH_GATETIME=0"; 375 | # ExecStart = '' 376 | # ${pkgs.autossh}/bin/autossh -M 0 -oStrictHostKeyChecking=no -oServerAliveInterval=60 -oServerAliveCountMax=3 -oExitOnForwardFailure=yes -N -R :666:localhost:666 magnetophon@81.7.19.118 377 | # ''; 378 | # # Restart="always"; 379 | # }; 380 | # }; 381 | }; 382 | 383 | security.sudo.extraConfig = '' 384 | bart ALL=(ALL) NOPASSWD: ${pkgs.systemd}/bin/systemctl 385 | ''; 386 | 387 | } 388 | -------------------------------------------------------------------------------- /machines/nixframe/machine.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, ... }: 2 | with pkgs; { 3 | # imports = [ ]; 4 | 5 | networking.hostId = "f2119c72"; 6 | 7 | boot.loader.systemd-boot.memtest86.enable = true; 8 | 9 | system.stateVersion = "23.05"; # Did you read the comment? 10 | 11 | environment = { 12 | systemPackages = [ 13 | # (import /home/bart/source/fw-ectool/default.nix) 14 | fw-ectool 15 | intel-gpu-tools # for verifying HW acceleration with intel_gpu_top 16 | ]; 17 | }; 18 | security.sudo.extraConfig = '' 19 | bart ALL=(root) NOPASSWD: /root/.local/bin/key_brightness.sh 20 | bart ALL=(root) NOPASSWD: /root/.local/bin/get_fan_rpm.sh 21 | bart ALL=(root) NOPASSWD: /root/.local/bin/toggle_fan_max.sh 22 | ''; 23 | hardware.fw-fanctrl.enable = true; 24 | # 25 | services = { 26 | 27 | 28 | xserver = { 29 | # videoDrivers = [ "modesetting" ]; 30 | # Fix font sizes in X 31 | dpi = 120; 32 | # videoDrivers = [ "intel" ]; 33 | # windowManager.remote_i3.enable = true; 34 | windowManager.i3 = { 35 | enable = true; 36 | # extraSessionCommands = "{pkgs.physlock}/bin/physlock -ds"; 37 | }; 38 | }; 39 | 40 | displayManager = { 41 | defaultSession = "none+i3"; 42 | # # disable middle mouse buttons 43 | # sessionCommands = '' 44 | # xinput set-button-map 10 1 0 3 && 45 | # xinput set-button-map 11 1 0 3 && 46 | # physlock -ds 47 | # ''; 48 | autoLogin = { 49 | enable = true; 50 | user = "bart"; 51 | }; 52 | }; 53 | 54 | smartd = { 55 | enable = true; 56 | devices = [ 57 | # { device = "/dev/sda"; } 58 | { 59 | device = "/dev/nvme0n1"; 60 | } 61 | # { device = "/dev/sdb"; } 62 | ]; 63 | notifications.test = true; 64 | notifications.x11.enable = true; 65 | }; 66 | 67 | ntp.enable = false; 68 | chrony.enable = true; 69 | 70 | picom = { 71 | # we start it as needed, config in dotfiles 72 | # enable = true; 73 | # time compton --config /dev/null --backend glx --benchmark 100 74 | # time compton --config /dev/null --backend xrender --benchmark 100 75 | # the above gives xrender as the quickest option, but it tears, whereas glx does not 76 | # backend = "glx"; 77 | # vSync = true; 78 | # vSync = "opengl-swc"; 79 | # vSync = "opengl-oml"; 80 | # extraOptions = "paint-on-overlay = true"; 81 | # settings = "unredir-if-possible = true"; 82 | # settings = "unredir-if-possible = true"; 83 | }; 84 | fwupd = { 85 | enable = true; 86 | extraRemotes = [ "lvfs-testing" ]; 87 | uefiCapsuleSettings.DisableCapsuleUpdateOnDisk = true; 88 | }; 89 | # Framework laptop doesn't require battery polling. 90 | # upower.noPollBatteries = true; 91 | 92 | }; 93 | # docker for stratus compilation: 94 | virtualisation.docker.enable = true; 95 | users.users.bart = { 96 | extraGroups = [ "docker" ]; 97 | }; 98 | boot.binfmt.emulatedSystems = [ 99 | "armv7l-linux" 100 | ]; 101 | 102 | # environment.etc."fwupd/fwupd.conf" = lib.mkForce { 103 | # source = 104 | # pkgs.runCommand "fwupd-with-uefi-capsule-update-on-disk-disable.conf" 105 | # { } '' 106 | # cat ${pkgs.fwupd}/etc/fwupd/fwupd.conf > $out 107 | # cat >> $out < 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /vim.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: { 2 | environment.systemPackages = with pkgs; 3 | [ 4 | (vim_configurable.customize { 5 | name = "vim"; 6 | vimrcConfig.customRC = '' 7 | 8 | " General { 9 | set nocompatible 10 | filetype plugin indent on " Automatically detect file types. 11 | syntax on " Syntax highlighting 12 | set mouse=a " Automatically enable mouse usage 13 | set mousehide " Hide the mouse cursor while typing 14 | scriptencoding utf-8 15 | "use system clipboard 16 | set clipboard=unnamed,unnamedplus 17 | "automatically switch to the current file directory when a new buffer is opened 18 | "autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif 19 | set autochdir " sets the working directory to the current file. 20 | set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter') 21 | set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility 22 | " {block|insert|all|onemore} sets where the cursor can be positioned when there is no actual character. 23 | set virtualedit=block,onemore 24 | set diffopt+=context:1000000 " don't fold 25 | set history=1000 " Store a ton of history (default is 20) 26 | set hidden " Allow buffer switching without saving 27 | set iskeyword-=. " '.' is an end of word designator 28 | set iskeyword-=# " '#' is an end of word designator 29 | set iskeyword-=- " '-' is an end of word designator 30 | 31 | set ttimeout 32 | set ttimeoutlen=1000 33 | 34 | if !empty(&viminfo) 35 | set viminfo^=! 36 | endif 37 | 38 | set sessionoptions="buffers,curdir" 39 | 40 | " Instead of reverting the cursor to the last position in the buffer, we 41 | " set it to the first line when editing a git commit message 42 | au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0]) 43 | au FileType gitcommit setlocal spell 44 | 45 | " http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session 46 | " Restore cursor to file position in previous editing session 47 | 48 | function! ResCur() 49 | if line("'\"") <= line("$") 50 | normal! g`" 51 | return 1 52 | endif 53 | endfunction 54 | 55 | augroup resCur 56 | autocmd! 57 | autocmd BufWinEnter * call ResCur() 58 | augroup END 59 | 60 | " Setting up the directories { 61 | set backup " Backups are nice ... 62 | set undofile " So is persistent undo ... 63 | set undolevels=1000 " Maximum number of changes that can be undone 64 | set undoreload=10000 " Maximum number lines to save for undo on a buffer reload 65 | "} 66 | "} 67 | 68 | " Vim UI { 69 | "use the light solarized theme: 70 | "colorscheme solarized 71 | let g:solarized_termcolors=256 72 | color solarized " Load a colorscheme 73 | set background=light 74 | highlight Normal ctermbg=white 75 | highlight LineNr ctermbg=lightgrey ctermfg=None 76 | " Default Colors for CursorLine 77 | highlight CursorLine ctermbg=lightgrey ctermfg=None 78 | set colorcolumn=80 79 | highlight ColorColumn ctermbg=lightgrey 80 | hi Folded ctermbg=White 81 | 82 | 83 | "hybrid line number: 84 | set number 85 | set relativenumber 86 | 87 | set ruler " Show the ruler 88 | set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids 89 | set showcmd " Show partial commands in status line and 90 | " Selected characters/lines in visual mode 91 | 92 | set laststatus=2 93 | 94 | " Broken down into easily includeable segments 95 | set statusline=%<%f\ " Filename 96 | set statusline+=%w%h%m%r " Options 97 | set statusline+=%{fugitive#statusline()} " Git Hotness 98 | set statusline+=\ [%{&ff}/%Y] " Filetype 99 | set statusline+=\ [%{getcwd()}] " Current dir 100 | set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info 101 | 102 | set tabpagemax=15 " Only show 15 tabs 103 | set showmode " Display the current mode 104 | set cursorline " Highlight current line 105 | set backspace=indent,eol,start " Backspace for dummies 106 | set showmatch " Show matching brackets/parenthesis 107 | set incsearch " Find as you type search 108 | set hlsearch " Highlight search terms 109 | set gdefault " makes the s% flag global by default. Use /g to turn the global option off. 110 | set ignorecase " Case insensitive search 111 | set smartcase " Case sensitive when uc present 112 | set wildmenu " Show list instead of just completing 113 | set wildmode=list:longest,full " Command completion, list matches, then longest common part, then all. 114 | set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too 115 | set scrolljump=5 " Lines to scroll when cursor leaves screen 116 | set scrolloff=3 " Minimum lines to keep above and below cursor 117 | set list 118 | set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace 119 | set splitright " split vertical splits to the right 120 | set splitbelow " split horizontal splits to the bottom 121 | 122 | function! ILikeHelpToTheRight() 123 | if !exists('w:help_is_moved') || w:help_is_moved != "right" 124 | wincmd L 125 | let w:help_is_moved = "right" 126 | endif 127 | endfunction 128 | 129 | augroup HelpPages 130 | autocmd FileType help nested call ILikeHelpToTheRight() 131 | augroup END 132 | 133 | " } 134 | 135 | " Formatting { 136 | 137 | set wrap " Wrap long lines 138 | set autoindent " Indent at the same level of the previous line 139 | set shiftwidth=4 " Use indents of 4 spaces 140 | set expandtab " Tabs are spaces, not tabs 141 | set tabstop=4 " An indentation every four columns 142 | set softtabstop=4 " Let backspace delete indent 143 | "set matchpairs+=<:> " Match, to be used with % 144 | set pastetoggle= " pastetoggle (sane indentation on pastes) 145 | "set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks 146 | " Remove trailing whitespaces and ^M chars 147 | autocmd FileType faust,c,cpp,java,go,php,javascript,puppet,python,rust,twig,xml,yml,perl,sql autocmd BufWritePre call StripTrailingWhitespace() 148 | 149 | 150 | " wiki files get VimOutliner. 151 | "autocmd BufNewFile,BufRead *.wiki set filetype=votl 152 | 153 | " text and email get flowed format: 154 | " autocmd FileType mail,text,markdown,md,votl call Mail_Style() 155 | " fun! Mail_Style() 156 | " " Support Format-Flowed in email (mutt). 157 | " setlocal fo+=aw tw=72 158 | " setlocal spell 159 | " endfun 160 | 161 | " Don't use modelines in e-mail messages, avoid trojan horses and nasty 162 | " "jokes" (e.g., setting 'textwidth' to 5). 163 | autocmd FileType mail setlocal nomodeline 164 | 165 | " Ensure tabs in Makefiles. 166 | autocmd FileType make setlocal noexpandtab 167 | " } 168 | 169 | " Key (re)Mappings { 170 | 171 | " the biggest key for the most used function 172 | noremap : 173 | " The default leader is '\', but many people prefer ',' as it's in a standard 174 | " location. 175 | let mapleader = ',' 176 | let maplocalleader = ',,' 177 | 178 | " redraw screen, also turn off search highlighting, and reload the 179 | " file if it changed (works in conjunction with `set autoread`) 180 | nnoremap :nohlsearch:redraw:checktime 181 | 182 | " Wrapped lines goes down/up to next row, rather than next line in file. 183 | noremap j gj 184 | noremap k gk 185 | 186 | " End/Start of line motion keys act relative to row/wrap width in the 187 | " presence of `:set wrap`, and relative to line for `:set nowrap`. 188 | " Same for 0, home, end, etc 189 | function! WrapRelativeMotion(key, ...) 190 | let vis_sel="" 191 | if a:0 192 | let vis_sel="gv" 193 | endif 194 | if &wrap 195 | execute "normal!" vis_sel . "g" . a:key 196 | else 197 | execute "normal!" vis_sel . a:key 198 | endif 199 | endfunction 200 | 201 | " Map g* keys in Normal, Operator-pending, and Visual+select 202 | noremap $ :call WrapRelativeMotion("$") 203 | noremap :call WrapRelativeMotion("$") 204 | noremap 0 :call WrapRelativeMotion("0") 205 | noremap :call WrapRelativeMotion("0") 206 | noremap ^ :call WrapRelativeMotion("^") 207 | " Overwrite the operator pending $/ mappings from above 208 | " to force inclusive motion with :execute normal! 209 | onoremap $ v:call WrapRelativeMotion("$") 210 | onoremap v:call WrapRelativeMotion("$") 211 | " Overwrite the Visual+select mode mappings from above 212 | " to ensure the correct vis_sel flag is passed to function 213 | vnoremap $ :call WrapRelativeMotion("$", 1) 214 | vnoremap :call WrapRelativeMotion("$", 1) 215 | vnoremap 0 :call WrapRelativeMotion("0", 1) 216 | vnoremap :call WrapRelativeMotion("0", 1) 217 | vnoremap ^ :call WrapRelativeMotion("^", 1) 218 | " Stupid shift key fixes 219 | command! -bang -nargs=* -complete=file E e 220 | command! -bang -nargs=* -complete=file W w 221 | command! -bang -nargs=* -complete=file Wq wq 222 | command! -bang -nargs=* -complete=file WQ wq 223 | command! -bang Wa wa 224 | command! -bang WA wa 225 | command! -bang Q q 226 | command! -bang QA qa 227 | command! -bang Qa qa 228 | 229 | cmap Tabe tabe 230 | 231 | " Yank from the cursor to the end of the line, to be consistent with C and D. 232 | nnoremap Y y$ 233 | 234 | "go to first and last char of line 235 | nnoremap H ^ 236 | nnoremap L g_ 237 | vnoremap H ^ 238 | vnoremap L g_ 239 | 240 | " Visual shifting (does not exit Visual mode) 241 | vnoremap < >gv 243 | 244 | " Allow using the repeat operator with a visual selection (!) 245 | " http://stackoverflow.com/a/8064607/127816 246 | vnoremap . :normal . 247 | 248 | " simpler folds 249 | " zo opens all folds 250 | " zc closes all folds 251 | " za to toggle each fold 252 | nnoremap zo zR 253 | nnoremap zc zM 254 | 255 | "faust 256 | autocmd BufNewFile,BufRead *.dsp set filetype=faust 257 | autocmd BufNewFile,BufRead *.lib set filetype=faust 258 | 259 | " 260 | autocmd filetype c nnoremap :w :!gcc % -o %:r && ./%:r 261 | 262 | " 263 | autocmd filetype faust nnoremap :w :!faust2jack -osc % && ./% 264 | "autocmd filetype faust nnoremap :w :!faust2jack -osc % && ./% & sleep 1 && jack_disconnect %:out_0 system:playback_1 && jack_disconnect %:out_1 system:playback_2 && jack_connect %:out_0 ardour:insert\ 1/audio_return\ 1 && jack_connect %:out_1 ardour:insert\ 1/audio_return\ 2 && jack_connect %:in_0 ardour:insert\ 1/audio_send\ 1 && jack_connect %:in_1 ardour:insert\ 1/audio_send\ 2 265 | autocmd filetype faust nnoremap :w :!faust2firefox % 266 | 267 | autocmd filetype help set keywordprg=:help 268 | 269 | "buffer navigation: 270 | nmap :bp 271 | nmap :bn 272 | 273 | "center search results on the screen 274 | nnoremap N Nzz 275 | nnoremap n nzz 276 | nnoremap * *zz 277 | nnoremap # #zz 278 | nnoremap g* g*zz 279 | nnoremap g# g#zz 280 | 281 | 282 | " Use sane regexes. 283 | nnoremap / /\v 284 | vnoremap / /\v 285 | 286 | " Automatically jump to end of text you pasted: 287 | vnoremap y y`] 288 | vnoremap p p`] 289 | nnoremap p p`] 290 | 291 | "Prevent replacing paste buffer on paste: 292 | " vp doesn't replace paste buffer 293 | function! RestoreRegister() 294 | let @" = s:restore_reg 295 | return ' ' 296 | endfunction 297 | function! s:Repl() 298 | let s:restore_reg = @" 299 | return "p@=RestoreRegister()\" 300 | endfunction 301 | vmap p Repl() 302 | " make this the only window, fe to stop diffing 303 | noremap wo 304 | 305 | " easier navigation between split windows 306 | " conflicts with for redraw 307 | " nnoremap j 308 | " nnoremap k 309 | " nnoremap h 310 | " nnoremap l 311 | " } 312 | 313 | " Plugins { 314 | 315 | " CtrlP { 316 | noremap :CtrlPBuffer 317 | "} 318 | " Fugitive { 319 | nnoremap gs :Gstatus 320 | nnoremap gd :Gdiff 321 | nnoremap gc :Gcommit 322 | nnoremap gb :Gblame 323 | nnoremap gl :Glog 324 | nnoremap gp :Git push 325 | nnoremap gr :Gread 326 | nnoremap gw :Gwrite 327 | nnoremap ge :Gedit 328 | " Mnemonic _i_nteractive 329 | nnoremap gi :Git add -p % 330 | nnoremap gg :SignifyToggle 331 | "} 332 | 333 | " NERDTree { 334 | noremap e :NERDTreeToggle 335 | "} 336 | 337 | " rainbow_parentheses { 338 | nnoremap r :RainbowParenthesesToggle 339 | au Syntax * RainbowParenthesesLoadRound 340 | au Syntax * RainbowParenthesesLoadSquare 341 | au Syntax * RainbowParenthesesLoadBraces 342 | "} 343 | 344 | " Tabularize { 345 | nmap a& :Tabularize /& 346 | vmap a& :Tabularize /& 347 | nmap a= :Tabularize /^[^=]*\zs= 348 | vmap a= :Tabularize /^[^=]*\zs= 349 | nmap a=> :Tabularize /=> 350 | vmap a=> :Tabularize /=> 351 | nmap a: :Tabularize /: 352 | vmap a: :Tabularize /: 353 | nmap a:: :Tabularize /:\zs 354 | vmap a:: :Tabularize /:\zs 355 | nmap a, :Tabularize /, 356 | vmap a, :Tabularize /, 357 | nmap a,, :Tabularize /,\zs 358 | vmap a,, :Tabularize /,\zs 359 | nmap a :Tabularize / 360 | vmap a :Tabularize / 361 | " } 362 | 363 | " ctrlp { 364 | let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""' 365 | "} 366 | 367 | 368 | " UndoTree { 369 | nnoremap u :UndotreeToggle 370 | nnoremap u :UndotreeToggle 371 | " If undotree is opened, it is likely one wants to interact with it. 372 | let g:undotree_SetFocusWhenToggle=1 373 | 374 | "} 375 | 376 | 377 | " YouCompleteMe { 378 | let g:ycm_filetype_blacklist = { 379 | \ 'tagbar' : 1, 380 | \ 'qf' : 1, 381 | \ 'unite' : 1, 382 | \ 'infolog' : 1, 383 | \} 384 | let g:acp_enableAtStartup = 0 385 | " enable completion in comments 386 | let g:ycm_complete_in_comments = 1 387 | " enable completion from tags 388 | let g:ycm_collect_identifiers_from_tags_files = 1 389 | " enable completion from comments and strings 390 | let g:ycm_collect_identifiers_from_comments_and_strings = 1 391 | " enable completion from syntax defenition 392 | let g:ycm_seed_identifiers_with_syntax = 1 393 | 394 | " remap Ultisnips for compatibility for YCM 395 | let g:UltiSnipsExpandTrigger = '' 396 | let g:UltiSnipsJumpForwardTrigger = '' 397 | let g:UltiSnipsJumpBackwardTrigger = '' 398 | 399 | " Enable omni completion. 400 | autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS 401 | autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags 402 | autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS 403 | autocmd FileType python setlocal omnifunc=pythoncomplete#Complete 404 | autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags 405 | autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete 406 | autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc 407 | 408 | " Haskell post write lint and check with ghcmod 409 | " $ `cabal install ghcmod` if missing and ensure 410 | " ~/.cabal/bin is in your $PATH. 411 | if !executable("ghcmod") 412 | autocmd BufWritePost *.hs GhcModCheckAndLintAsync 413 | endif 414 | 415 | " For snippet_complete marker. 416 | set conceallevel=2 concealcursor=i 417 | 418 | " Disable the neosnippet preview candidate window 419 | " When enabled, there can be too much visual noise 420 | " especially when splits are used. 421 | set completeopt-=preview 422 | " } 423 | 424 | " vim-airline { 425 | " Set configuration options for the statusline plugin vim-airline. 426 | " Use the powerline theme and optionally enable powerline symbols. 427 | " To use the symbols , , , , , , and .in the statusline 428 | " segments add the following to your .vimrc.before.local file: 429 | " let g:airline_powerline_fonts=1 430 | " If the previous symbols do not render for you then install a 431 | " powerline enabled font. 432 | 433 | " See `:echo g:airline_theme_map` for some more choices 434 | " Default in terminal vim is 'dark' 435 | "let g:airline_theme = 'solarized' 436 | " Automatically displays all buffers when there's only one tab open. 437 | let g:airline#extensions#tabline#enabled = 1 438 | 439 | " } 440 | 441 | " } 442 | 443 | " Specify a different directory in which to place the vimbackup, 444 | " vimviews, vimundo, and vimswap files/directories, add the following to 445 | set backupdir=~/.vim/backup// 446 | set directory=~/.vim/swap// 447 | set undodir=~/.vim/undo// 448 | 449 | " Strip whitespace { 450 | function! StripTrailingWhitespace() 451 | " Preparation: save last search, and cursor position. 452 | let _s=@/ 453 | let l = line(".") 454 | let c = col(".") 455 | " do the business: 456 | %s/\s\+$//e 457 | " clean up: restore previous search history, and cursor position 458 | let @/=_s 459 | call cursor(l, c) 460 | endfunction 461 | " } 462 | 463 | 464 | 465 | 466 | 467 | "writes current mappings to a file 468 | redir! > ~/.vim/vim_keys.txt 469 | silent verbose map 470 | redir END 471 | 472 | " local plugins and synthaxes: 473 | source ~/.vimrc 474 | 475 | ''; 476 | 477 | vimrcConfig.vam.knownPlugins = pkgs.vimPlugins; 478 | vimrcConfig.vam.pluginDictionaries = [{ 479 | names = [ 480 | "airline" 481 | "colors-solarized" 482 | "ctrlp" 483 | "fugitive" 484 | "nerdcommenter" 485 | "nerdtree" 486 | "rainbow_parentheses" 487 | "Tabular" 488 | "undotree" 489 | "vim-addon-nix" 490 | "youcompleteme" 491 | ]; 492 | } 493 | #{ name = "github:gmoe/vim-faust"; ft_regex = "^faust\$"; } 494 | #doesn't work: 495 | #"vim-addon-local-vimrc" 496 | #replaced by voom: 497 | #"VimOutliner" 498 | #doesn't work: 499 | #"YankRing" 500 | #gives error on startup: 501 | #"UltiSnips" 502 | ]; 503 | }) 504 | ]; 505 | } 506 | -------------------------------------------------------------------------------- /common.nix: -------------------------------------------------------------------------------- 1 | # https://discourse.nixos.org/t/nixos-without-a-display-manager/360/11 2 | 3 | { pkgs, config, ... }: 4 | with pkgs; 5 | let 6 | my-python-packages = 7 | python-packages: with python-packages; [ 8 | # pandas 9 | # requests 10 | pyperclip 11 | # ueberzug 12 | # other python packages you want 13 | ]; 14 | python-with-my-packages = python3.withPackages my-python-packages; 15 | in 16 | { 17 | 18 | imports = [ 19 | # ./vim.nix 20 | # ./dns-crypt.nix 21 | ]; 22 | 23 | hardware = { 24 | enableAllFirmware = true; 25 | # enableRedistributableFirmware = true; 26 | cpu = { 27 | amd.updateMicrocode = true; 28 | intel.updateMicrocode = true; 29 | }; 30 | bluetooth.enable = true; 31 | # bluetooth.settings = { 32 | # General = { 33 | # Enable = "Source,Sink,Media,Socket"; 34 | # Disable= "Source"; 35 | # }; 36 | # }; 37 | }; 38 | # for skype 39 | # hardware.pulseaudio = { 40 | # enable = true; 41 | # package = pkgs.pulseaudio.override { jackaudioSupport = true; }; 42 | # }; 43 | 44 | # rtkit is optional but recommended 45 | security.rtkit.enable = true; 46 | 47 | # done in jack module: 48 | # systemd.user.services.pulseaudio.environment = { 49 | # JACK_PROMISCUOUS_SERVER = "jackaudio"; 50 | # }; 51 | 52 | boot = { 53 | # loader.systemd-boot = { 54 | # enable = true; 55 | # consoleMode = "max"; 56 | # memtest86.enable = true; # unfree 57 | # }; 58 | # loader.efi.canTouchEfiVariables = true; 59 | loader.timeout = 1; 60 | tmp.cleanOnBoot = true; 61 | # no beep, no webcam 62 | blacklistedKernelModules = [ 63 | "snd_pcsp" 64 | "pcspkr" 65 | "uvcvideo" 66 | ]; 67 | kernel.sysctl = { 68 | "net.ipv4.ip_forward" = 1; 69 | }; # for network in VM 70 | kernelModules = [ 71 | "kvm-intel" 72 | "kvm-amd" 73 | "tun" 74 | "virtio" 75 | ]; 76 | # Add ZFS support. 77 | supportedFilesystems = [ "zfs" ]; 78 | }; 79 | 80 | nix = { 81 | # distributedBuilds = true; 82 | # buildMachines = [ 83 | # { hostName = "nxb-4"; 84 | # system = "x86_64-linux"; 85 | # maxJobs = 100; 86 | # supportedFeatures = [ "benchmark" ]; 87 | # } 88 | # { hostName = "nxb-16"; 89 | # system = "x86_64-linux"; 90 | # maxJobs = 100; 91 | # supportedFeatures = [ "benchmark" ]; 92 | # mandatoryFeatures = [ "big-parallel" ]; 93 | # } 94 | # ]; 95 | 96 | settings = { 97 | sandbox = true; 98 | extra-sandbox-paths = [ "/home/nixchroot" ]; 99 | require-sigs = true; 100 | }; 101 | # useSandbox = true; 102 | # sandboxPaths = [ "/home/nixchroot" ]; 103 | # requireSignedBinaryCaches = true; 104 | 105 | extraOptions = lib.optionalString (config.nix.package == nixVersions.stable) '' 106 | gc-keep-outputs = true # Nice for developers 107 | gc-keep-derivations = true # Idem 108 | env-keep-derivations = false 109 | # binary-caches = https://nixos.org/binary-cache 110 | # trusted-binary-caches = https://nixos.org/binary-cache https://cache.nixos.org https://hydra.nixos.org 111 | auto-optimise-store = true 112 | experimental-features = nix-command flakes 113 | # The timeout (in seconds) for receiving data from servers during download. Nix cancels idle downloads after this timeout's duration. 114 | # default 300 115 | stalled-download-timeout = 600 116 | ''; 117 | package = nixVersions.stable; 118 | }; 119 | 120 | # Copy the system configuration int to nix-store. 121 | # system.copySystemConfiguration = true; 122 | # https://www.reddit.com/r/NixOS/comments/84ytiu/is_it_possible_to_access_the_current_systems/ 123 | # The command provided creates a symbolic link of the current contents of /etc/nixos (copied into the Nix store) into the current Nix profile being generated. All of the configuration files are accessible at /var/run/current-system/full-config/ 124 | # 125 | # todo; more elaborate version: https://git.ophanim.de/derped/nixos/src/branch/master/options/copySysConf.nix 126 | system.systemBuilderCommands = '' 127 | ln -s ${./.} $out/full-config 128 | ''; 129 | ## error: attribute 'nixos-version' missing 130 | # mkdir -p $out/full-config 131 | # cd ${pkgs.nixos-version}/bin/ 132 | # ./nixos-version > $out/full-config/nixos-version 133 | 134 | # fileSystems= { 135 | 136 | # "/mnt/radio" = { 137 | # device = "//stor.adm/tank_radio"; 138 | # fsType = "cifs"; 139 | # # this line prevents hanging on network split 140 | 141 | # options = [ "x-systemd.automount" "nounix" "noperm" "noauto" "x-systemd.idle-timeout=60" "x-systemd.device-timeout=5s" "x-systemd.mount-timeout=5s" ]; 142 | # }; 143 | 144 | # "/mnt/graphic_public" = { 145 | # device = "//stor.adm/tank_graphic_public"; 146 | # fsType = "cifs"; 147 | # # this line prevents hanging on network split 148 | # options = [ "x-systemd.automount" "nounix" "noperm" "noauto" "x-systemd.idle-timeout=60" "x-systemd.device-timeout=5s" "x-systemd.mount-timeout=5s"]; 149 | 150 | # }; 151 | # "/mnt/videos" = { 152 | # device = "//stor.adm/tank_videos"; 153 | # fsType = "cifs"; 154 | # # this line prevents hanging on network split 155 | # options = [ "x-systemd.automount" "nounix" "noperm" "noauto" "x-systemd.idle-timeout=60" "x-systemd.device-timeout=5s" "x-systemd.mount-timeout=5s"]; 156 | 157 | # }; 158 | # "/mnt/torrent.adm" = { 159 | # device = "//stor.adm/tank_torrent.adm"; 160 | # fsType = "cifs"; 161 | # # this line prevents hanging on network split 162 | # options = [ "x-systemd.automount" "nounix" "noperm" "noauto" "x-systemd.idle-timeout=60" "x-systemd.device-timeout=5s" "x-systemd.mount-timeout=5s"]; 163 | 164 | # }; 165 | # }; 166 | 167 | services = { 168 | ringboard.x11.enable = true; 169 | 170 | # angrr.enable = true; 171 | 172 | # SMART. 173 | fstrim.enable = true; 174 | 175 | fwupd.enable = true; 176 | 177 | espanso.enable = true; 178 | 179 | # nixosManual.showManual = false; 180 | printing = { 181 | enable = true; 182 | drivers = [ brlaser ]; 183 | # drivers = [ brlaser hplipWithPlugin ]; # unfree 184 | }; 185 | # avahi = { 186 | # enable = true; 187 | # nssmdns = true; 188 | # publish.userServices = true; 189 | # }; 190 | acpid.enable = true; 191 | cron.enable = false; 192 | #avahi.enable = true; 193 | #locate.enable = true; 194 | # journald.extraConfig = '' 195 | # [Journal] 196 | # SystemMaxUse=50M 197 | # SystemMaxFileSize=10M 198 | # ''; 199 | openssh = { 200 | enable = true; 201 | ports = [ 22 ]; 202 | settings = { 203 | PermitRootLogin = "without-password"; 204 | # permitRootLogin = "yes"; 205 | PasswordAuthentication = false; 206 | X11Forwarding = true; 207 | 208 | }; 209 | startWhenNeeded = true; 210 | 211 | }; 212 | 213 | # mingetty.autologinUser = "bart"; 214 | 215 | xserver = { 216 | enable = true; 217 | enableCtrlAltBackspace = true; 218 | 219 | displayManager = { 220 | # startx.enable = true; 221 | lightdm = { 222 | enable = true; 223 | # greeter.enable = false; 224 | # autoLogin = { 225 | # enable = true; 226 | # user = "bart"; 227 | }; 228 | # extraSeatDefaults = '' 229 | # [Seat:*] 230 | # greeter-setup-script=physlock 231 | # ''; 232 | # }; 233 | }; 234 | 235 | # extraConfig = '' 236 | # # sessionstart_cmd ${pkgs.physlock}/bin/physlock -ds 237 | # # ''; 238 | # # sessionstart_cmd /run/current-system/sw/bin/touch ~/1234 239 | 240 | # displayManager.sddm = { 241 | # enable = true; 242 | # autoLogin = { 243 | # enable = true; 244 | # user = "bart"; 245 | # }; 246 | # # setupScript = "{pkgs.physlock}/bin/physlock -ds"; 247 | # setupScript = "physlock -ds"; 248 | # }; 249 | 250 | # displayManager.setupCommands = '' 251 | # physlock -ds 252 | # ''; 253 | 254 | # disable middle mouse buttons 255 | # to determine id: 256 | # xinput list | grep 'id=' 257 | # lock screen 258 | 259 | # displayManager.sessionCommands = '' 260 | # physlock -ds 261 | # ''; 262 | # xinput set-button-map 10 1 0 3 && 263 | # xinput set-button-map 11 1 0 3 && 264 | 265 | # physlock -ds 266 | 267 | # ^^ workaround for issue 33168 268 | # displayManager.sddm = { 269 | # enable = true; 270 | # autoLogin.enable = true; 271 | # autoLogin.user = "bart"; 272 | # setupScript = "{pkgs.physlock}/bin/physlock -ds"; 273 | # }; 274 | # Yes, this is a hack. 275 | # displayManager.setupCommands = "${pkgs.physlock}/bin/physlock -ds"; 276 | # displayManager.setupCommands = "physlock -ds"; 277 | 278 | # sudo -u bart ${pkgs.physlock}/bin/physlock -ds 279 | # synaptics = import ./synaptics.nix; 280 | config = '' 281 | Section "InputClass" 282 | Identifier "Enable libinput for TrackPoint" 283 | MatchIsPointer "on" 284 | Driver "libinput" 285 | EndSection 286 | ''; 287 | desktopManager.xterm.enable = false; 288 | # desktopManager.plasma5.enable = true; 289 | xkb.options = "caps:swapescape"; 290 | xkb.variant = "altgr-intl"; 291 | # bitlbee.enable 292 | # Whether to run the BitlBee IRC to other chat network gateway. Running it allows you to access the MSN, Jabber, Yahoo! and ICQ chat networks via an IRC client. 293 | desktopManager.wallpaper.mode = "fill"; 294 | }; 295 | 296 | libinput = { 297 | enable = true; 298 | touchpad = { 299 | middleEmulation = false; 300 | accelSpeed = "0.1"; 301 | tappingButtonMap = "lrm"; 302 | }; 303 | }; 304 | 305 | unclutter-xfixes = { 306 | enable = true; 307 | threshold = 2; 308 | extraOptions = [ "ignore-scrolling" ]; 309 | }; 310 | # autofs = 311 | # { 312 | # enable = true; 313 | # autoMaster = 314 | # }; 315 | # emacs = { 316 | # enable = true; 317 | # defaultEditor = true; 318 | # package = (emacs.override { imagemagick = pkgs.imagemagickBig; }); 319 | # package = 320 | # ((emacsPackagesFor emacs26).emacsWithPackages (epkgs: [ # emacs 27 is default, but breaks faust for now 321 | # epkgs.vterm 322 | # ])); 323 | # ((emacsPackagesFor ((emacs.override { imagemagick = nixpkgs.imagemagickBig; srcRepo = true; }).overrideAttrs )).emacsWithPackages (epkgs: [ 324 | # epkgs.emacs-libvterm 325 | # ])); 326 | 327 | # package = pkgs.emacs.override { 328 | # nativeComp = true; 329 | # }; 330 | # package = ((emacsPackagesFor emacsNativeComp).emacsWithPackages 331 | # (epkgs: [ epkgs.vterm ])); 332 | # }; 333 | 334 | physlock = { 335 | enable = true; 336 | allowAnyUser = true; 337 | muteKernelMessages = true; 338 | lockOn = { 339 | suspend = true; # true is default 340 | hibernate = true; # true is default 341 | # extraTargets = ["display-manager.service"]; 342 | # Instead of locking at display-manager.service, lock after the graphical session is ready: 343 | # extraTargets = ["graphical.target"]; # or "multi-user.target" 344 | }; 345 | }; 346 | logind.settings.Login = { 347 | HandleLidSwitch = "suspend-then-hibernate"; 348 | HandleLidSwitchExternalPower = "suspend-then-hibernate"; 349 | HandleLidSwitchDocked = "ignore"; 350 | HandlePowerKey = "suspend-then-hibernate"; 351 | HandlePowerKeyLongPress = "poweroff"; 352 | # extraConfig = '' 353 | # HandlePowerKey=suspend-then-hibernate 354 | # HibernateDelaySec=1h''; 355 | }; 356 | 357 | # logind.lidSwitch = "hibernate"; 358 | # logind.extraConfig = '' 359 | # HandleSuspendKey=hibernate 360 | # ''; 361 | # doesn't do anything 362 | # HandlePowerKey=hibernate 363 | 364 | # By default, udisks2 mounts removable drives under the ACL controlled directory /run/media/$USER/. If you wish to mount to /media instead, use this rule: 365 | udev.extraRules = '' 366 | # UDISKS_FILESYSTEM_SHARED 367 | # ==1: mount filesystem to a shared directory (/media/VolumeName) 368 | # ==0: mount filesystem to a private directory (/run/media/$USER/VolumeName) 369 | # See udisks(8) 370 | ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1" 371 | ''; 372 | # dbus.socketActivated = true; 373 | # gvfs.enable = true; # for url handling of pqiv, see https://github.com/phillipberndt/pqiv/issues/114 doesn't work yet on nixos 374 | # gvfs.package = pkgs.gnome3.gvfs; 375 | # plug-n-play tethering for iPhones: 376 | # disabled because of https://github.com/NixOS/nixpkgs/issues/77189 377 | # usbmuxd.enable = true; 378 | 379 | dnsmasq = { 380 | enable = false; 381 | settings = { 382 | # interface = "lo"; 383 | # bind-interfaces = true; 384 | # no-negcache = true; 385 | cache-size = 10000; 386 | # local-ttl = 300; 387 | # conf-dir = "/etc/dnsmasq.d/,*.conf"; 388 | # conf-file = "${blockedFqdns}/domains"; 389 | addn-hosts = "/var/lib/hostsblock/hosts.block"; 390 | # } // optionalAttrs stubbyEnabled { 391 | # no-resolv = true; 392 | # proxy-dnssec = true; 393 | # server = "127.0.0.1#153"; 394 | # }; 395 | # extraConfig = '' 396 | # cache-size=100000 397 | # addn-hosts=/var/lib/hostsblock/hosts.block 398 | # ''; 399 | }; 400 | }; 401 | upower = { 402 | enable = true; 403 | # percentageLow = 15; 404 | # percentageCritical = 10; 405 | # percentageAction = 5; 406 | }; 407 | # bluetooth gui: 408 | # use bluetui instead 409 | # blueman.enable = true; 410 | }; 411 | 412 | # systemd.sleep.extraConfig = "HibernateDelaySec=1h"; 413 | # Define time delay for hibernation 414 | systemd.sleep.extraConfig = '' 415 | HibernateDelaySec=30m 416 | SuspendState=mem 417 | ''; 418 | # documentation.nixos.includeAllModules = true; 419 | 420 | nixpkgs = { 421 | config = { 422 | allowUnfree = true; 423 | # allowUnfree = false; 424 | #firefox.enableAdobeFlash = true; 425 | # firefox.enableMplayer = true; 426 | # packageOverrides = pkgs : rec { 427 | # }; 428 | # pulseaudio = false; 429 | 430 | packageOverrides = pkgs: { 431 | # nur-combined = 432 | # import (builtins.fetchTarball "https://github.com/nix-community/nur-combined/archive/master.tar.gz") 433 | # { 434 | # inherit pkgs; 435 | # }; 436 | }; 437 | }; 438 | }; 439 | 440 | services.gnome.gnome-keyring.enable = true; 441 | 442 | # If you're not using GNOME, you might also need: 443 | programs.seahorse.enable = true; # GUI for managing keyring 444 | 445 | environment = { 446 | systemPackages = [ 447 | # m32edit 448 | authenticator 449 | gnome-keyring 450 | libsecret 451 | # for battery shutdown event: 452 | acpid 453 | acpi 454 | geany 455 | #system: 456 | unzip 457 | zip 458 | p7zip # insecure: https://github.com/NixOS/nixpkgs/commit/aa80b4780d849a00d86c28d6b3c78a777dd02e9a 459 | unar 460 | gnumake 461 | cmake 462 | gcc 463 | gdb 464 | ncurses 465 | bat 466 | bat-extras.batman 467 | lf 468 | nnn 469 | ncdu # disk usage analyzer, does not do paralel by default 470 | dust # disk usage analyzer, rust, fast 471 | # dua # disk usage analyzer, doesn't understand symbolic links 472 | gdu 473 | dysk 474 | ts 475 | rr # debugging 476 | coppwr # pipewire settings 477 | xdotool # for auto-type 478 | xorg.sessreg 479 | heimdall # for installing android etc 480 | coreutils 481 | ntfs3g 482 | cryptsetup 483 | openjdk 484 | stow 485 | tmux 486 | zellij 487 | tealdeer # tldr 488 | navi # An interactive cheatsheet tool for the command-line 489 | ollama 490 | languagetool 491 | mosh 492 | sshfs-fuse 493 | emacs 494 | gnutls # for doom emacs irc 495 | nodejs # for doom lsp mode 496 | rust-analyzer # for doom rust 497 | rustup # for doom rust 498 | shfmt # for doom sh formatting 499 | bacon # Background rust code checker 500 | rusty-man # Command-line viewer for documentation generated by rustdoc 501 | just # make alternative 502 | lldb # for helix 503 | cookiecutter 504 | kondo # Save disk space by cleaning unneeded files from software projects 505 | rxvt-unicode-unwrapped 506 | # alacritty 507 | alacritty-graphics 508 | kitty 509 | wezterm 510 | picom # compton fork 511 | zsh 512 | nixos-option 513 | nix-zsh-completions 514 | nix-diff 515 | nixfmt 516 | treefmt 517 | nixpkgs-fmt 518 | nix-tree 519 | nix-serve 520 | # nixops 521 | nix-du 522 | nix-tree 523 | nixpkgs-review 524 | gh # for nixpkgs-review 525 | nixpkgs-lint 526 | nix-prefetch-scripts 527 | nix-prefetch-git 528 | nix-index 529 | nixpkgs-review 530 | # rnix-lsp 531 | nix-output-monitor 532 | nix-your-shell 533 | nvd # diff system versions 534 | deploy-rs 535 | expect 536 | manix 537 | nox 538 | comma 539 | fish 540 | haskellPackages.ShellCheck 541 | fasd 542 | # zoxide # use module 543 | fzf 544 | skim 545 | bfs 546 | broot 547 | hyperfine # benchmarker 548 | stress # cpu stress 549 | grex # create regex from example 550 | rdfind 551 | openssl 552 | physlock 553 | asciinema 554 | neofetch 555 | fastfetch 556 | tuir 557 | wiki-tui 558 | tree 559 | htop 560 | bottom 561 | btop 562 | s-tui 563 | iotop 564 | powertop 565 | sysstat 566 | virt-manager 567 | # iptraf # broken 568 | nethogs 569 | inetutils 570 | trippy # network analyzer 571 | iftop 572 | hdparm 573 | testdisk 574 | udiskie 575 | mesa-demos 576 | libva-utils # collection of utilities and examples to exercise VA-API 577 | usbutils 578 | pciutils 579 | # latencytop 580 | linuxPackages.cpupower 581 | lsof 582 | psmisc 583 | gitFull 584 | hub # GitHub extension to git 585 | # gitAnnex 586 | diff-so-fancy 587 | diffoscope 588 | delta 589 | # grv # build failed 590 | tig 591 | gitui 592 | gist # upload to gist.github.com 593 | bfg-repo-cleaner # https://rtyley.github.io/bfg-repo-cleaner/ 594 | mercurial 595 | subversion 596 | curl 597 | nextcloud-client 598 | hostsblock 599 | steam-run 600 | patchelf 601 | # haskellPackages.ghc 602 | ruby 603 | # icedtea_web 604 | # font-manager 605 | xfontsel 606 | neovim 607 | (vim-full.customize { 608 | vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; { 609 | # loaded on launch 610 | start = [ 611 | "vim-sensible" 612 | "vim-sleuth" # Heuristically set buffer options 613 | 614 | ]; 615 | # manually loadable by calling `:packadd $plugin-name` 616 | # however, if a Vim plugin has a dependency that is not explicitly listed in 617 | # opt that dependency will always be added to start to avoid confusion. 618 | # opt = [ phpCompletion elm-vim ]; 619 | # To automatically load a plugin when opening a filetype, add vimrc lines like: 620 | # autocmd FileType php :packadd phpCompletion 621 | }; 622 | vimrcConfig.customRC = '' 623 | set clipboard=unnamedplus 624 | " relaive numbers 625 | set number relativenumber 626 | " Turn on syntax highlighting by default 627 | syntax on 628 | ''; 629 | }) 630 | texlive.combined.scheme-medium # :lang org -- for latex previews 631 | wordnet # for offline dictionary and thesaurus support 632 | # for emacs markdown-preview: 633 | # marked # node package 634 | pandoc 635 | haskellPackages.markdown 636 | # (mu.override { withMug = true; }) # mug got removed upstream 637 | mu 638 | editorconfig-core-c # per-project style config 639 | gnutls # for TLS connectivity 640 | imagemagickBig # for image-dired 641 | pinentry-emacs # in-emacs gnupg prompts 642 | zstd # for undo-tree compression 643 | 644 | dunst 645 | libnotify 646 | # ctagsWrapped.ctagsWrapped 647 | which 648 | gnuplot 649 | xorg.xkill 650 | xorg.xinit 651 | ltrace 652 | borgbackup 653 | restic 654 | storeBackup 655 | syncthing 656 | # syncthing-gtk # broken: https://github.com/NixOS/nixpkgs/commit/330ac8b3dcf1fbd76c21e05d4d88826799327d9c 657 | khard 658 | # khal 659 | vdirsyncer 660 | # https://github.com/NixOS/nixpkgs/issues/103026 661 | # pypyPackages.keyring 662 | python3 663 | python-with-my-packages 664 | gparted 665 | parted 666 | smartmontools 667 | unetbootin # has p7zip 668 | makeWrapper 669 | #vim 670 | # ( pkgs.xdg_utils.override { mimiSupport = true; }) 671 | xdg-utils 672 | shared-mime-info 673 | perlPackages.MIMETypes 674 | gnupg 675 | #windowmanager etc: 676 | wget 677 | i3 678 | # polybarFull 679 | jq 680 | i3status 681 | i3status-rust 682 | i3-layout-manager 683 | i3-resurrect 684 | autotiling-rs 685 | wmfocus 686 | xorg.xprop # get window props like class and insctance 687 | xorg.xev # get the name of a key or key-combo 688 | xwininfo 689 | uutils-coreutils-noprefix 690 | # busybox # for usleep: short sleep,used in /home/bart/.dot/common/.local/bin/brightness.sh to flash out of 0 691 | (busybox.overrideAttrs (oldAttrs: { 692 | postFixup = '' 693 | mkdir -p /tmp/xxxxxqqqqqyyyyy 694 | cp $out/bin/usleep /tmp/xxxxxqqqqqyyyyy 695 | cp $out/bin/busybox /tmp/xxxxxqqqqqyyyyy 696 | rm $out/bin/* 697 | cp /tmp/xxxxxqqqqqyyyyy/usleep $out/bin/ 698 | cp /tmp/xxxxxqqqqqyyyyy/busybox $out/bin/ 699 | ''; 700 | })) 701 | lm_sensors # for i3status-rust 702 | dmenu 703 | # clipster 704 | autocutsel 705 | rofi 706 | rofi-systemd 707 | rofimoji 708 | sysz # A fzf terminal UI for systemctl 709 | systemctl-tui 710 | 711 | impala 712 | networkmanager_dmenu 713 | ethtool 714 | dzen2 715 | xpra 716 | #desktop 717 | #desktop-file-utils 718 | # firefox-esr 719 | # (firefox-esr.override { nameSuffix="-esr"; }) 720 | firefox 721 | #for vimeo: 722 | # gstreamer 723 | # gst_plugins_base 724 | # gst_plugins_good 725 | # gst_plugins_bad 726 | # gst_plugins_ugly 727 | tor-browser 728 | i2pd 729 | qutebrowser 730 | sqlitebrowser 731 | python3Packages.pyperclip # for qutebrowser, https://github.com/LaurenceWarne/qute-code-hint 732 | # nyxt 733 | ungoogled-chromium 734 | # chromium 735 | # chromiumBeta 736 | # w3m 737 | (pkgs.w3m.override { graphicsSupport = true; }) 738 | yt-dlp 739 | # yt-dlp_git 740 | # freetube 741 | vlc 742 | # mumble 743 | # jitsi-meet-electron 744 | # zoom-us # unfree 745 | # (mumble.override { jackSupport = true; }) 746 | (mpv-unwrapped.override { 747 | jackaudioSupport = true; 748 | archiveSupport = true; 749 | vapoursynthSupport = true; 750 | }) 751 | yewtube 752 | shotwell # gst-plugins-base == broken 753 | # galculator 754 | qalculate-gtk 755 | libqalculate 756 | bc 757 | calc 758 | units 759 | rink # Unit conversion tool and library written in rust 760 | mepo # map application 761 | transmission_4-gtk 762 | # gamma_randr.c:38:10: fatal error: xcb/xcb.h: No such file or directory 763 | xrandr-invert-colors 764 | arandr 765 | xcalib 766 | sselp 767 | xclip 768 | pqiv 769 | feh 770 | gopass 771 | pass 772 | rofi-pass 773 | silver-searcher 774 | bluetui 775 | (ripgrep.override { withPCRE2 = true; }) 776 | ripgrep-all # also search in PDFs, E-Books, Office documents, zip, tar.gz, etc. 777 | fd # rust fast find alternative 778 | fselect # Find files with SQL-like queries 779 | eza # rust ls alternative 780 | inotify-tools # notify when a file changes 781 | trash-cli 782 | httm # Interactive, file-level Time Machine-like tool 783 | so # stack overflow from the cli 784 | # atuin # magical shell history 785 | # mcfly # shell history 786 | speedtest-cli 787 | # zed-editor 788 | evil-helix 789 | # xdg-desktop-portal-termfilechooser 790 | # joshuto 791 | # rust ranger clone 792 | # is now a sytem module 793 | # yazi 794 | yazi-unwrapped 795 | 796 | # yazi deps: 797 | file 798 | jq 799 | poppler-utils 800 | _7zz 801 | ffmpeg 802 | fd 803 | ripgrep 804 | fzf 805 | imagemagick 806 | chafa 807 | resvg 808 | # end yazi deps 809 | 810 | ranger 811 | # for ranger previews: 812 | atool 813 | highlight 814 | file 815 | libcaca 816 | odt2txt 817 | perlPackages.ImageExifTool 818 | ffmpegthumbnailer 819 | poppler-utils # for pdftotext 820 | lynx 821 | mediainfo 822 | fontforge 823 | # python3Packages.ueberzug 824 | # ueberzugpp 825 | libsixel 826 | # mutt-with-sidebar 827 | # mutt-kz 828 | # neomutt 829 | fclones # duplicate file finder 830 | xfce.thunar 831 | thunderbird 832 | isync 833 | jdupes 834 | lazygit 835 | # taskwarrior 836 | paperkey 837 | gpa 838 | # offlineimap replaced by isync 839 | # notmuch 840 | # alot 841 | # remind #calendar 842 | # wyrd # front end for remind 843 | #pypyPackages.alot 844 | #python27Packages.alot 845 | filezilla 846 | kdePackages.kcolorchooser 847 | gimp 848 | inkscape 849 | # (pkgs.blender.override { jackaudioSupport = true; }) 850 | blender 851 | openscad 852 | kdePackages.kdenlive 853 | # olive-editor 854 | ffmpeg-full 855 | simplescreenrecorder 856 | scrot 857 | flameshot 858 | # enable when this reaches nixos-unstable: https://nixpk.gs/pr-tracker.html?pr=297984 859 | # handbrake # gst-plugins-base == broken 860 | alsa-utils 861 | meld 862 | freemind 863 | # arduino 864 | baobab 865 | recoll 866 | # https://github.com/NixOS/nixpkgs/issues/50001 : 867 | zathura 868 | evince 869 | diff-pdf 870 | xournalpp # anotate pdf's 871 | kodi 872 | # (pkgs.pidgin-with-plugins.override { 873 | # plugins = [ pidginotr ]; 874 | # }) # pidgin + pidgin-otr 875 | # pidgin 876 | hexchat 877 | signal-desktop 878 | telegram-desktop 879 | weechat 880 | irssi 881 | gajim 882 | 883 | # non-free: 884 | # skypeforlinux 885 | #spideroak 886 | # unrar 887 | # calibre 888 | 889 | #toxprpl 890 | gtypist 891 | aspell 892 | aspellDicts.en 893 | aspellDicts.en-computers 894 | aspellDicts.en-science # doesn't build: https://github.com/NixOS/nixpkgs/issues/101184 895 | aspellDicts.nl 896 | aspellDicts.de 897 | hunspellDicts.en_US-large 898 | hunspellDicts.nl_NL 899 | hunspellDicts.de_DE 900 | # libreoffice-fresh 901 | libreoffice 902 | # k3b 903 | # iDevice stuff: 904 | # /pkgs/development/libraries/libplist/default.nix 905 | # has knownVulnerabilities 906 | # https://nixos.wiki/wiki/IOS 907 | usbmuxd 908 | libimobiledevice 909 | ifuse 910 | sqlite 911 | # see http://linuxsleuthing.blogspot.nl/2012/10/addressing-ios6-address-book-and-sqlite.html 912 | # https://gist.github.com/laacz/1180765 913 | #custom packages 914 | #nl_wa2014 915 | # needed for direnv: 916 | devenv 917 | nix-direnv 918 | nix-init 919 | ]; 920 | 921 | # applist = [ 922 | # {mimetypes = ["text/plain" "text/css"]; applicationExec = "${pkgs.vim_configurable}/bin/vim";} 923 | # {mimetypes = ["text/html"]; applicationExec = "${pkgs.firefox}/bin/firefox";} 924 | # ]; 925 | 926 | # xdg_default_apps = import /home/matej/workarea/helper_scripts/nixes/defaultapps.nix { inherit pkgs; inherit applist; }; 927 | 928 | # shells = [ pkgs.fish ]; 929 | # shells = [ pkgs.bash ]; 930 | shells = with pkgs; [ 931 | bashInteractive 932 | zsh 933 | fish 934 | ]; 935 | # Set of files that have to be linked in /etc. 936 | # etc = 937 | # { hosts = 938 | # # hostsblock -f /home/bart/.config/hostsblock/hostsblock.conf -u 939 | # { source = /home/bart/nixosConfig/hosts; 940 | # }; 941 | # }; 942 | 943 | # variables.NIX_AUTO_RUN = "!"; 944 | 945 | # Speaking of i3, if you enable both services.xserver.desktopManager.plasma5.enable = true; and services.xserver.windowManager.i3.enable = true; (for example), you get a neat extra: a combo option to run plasma with i3 as a window manager. Additionally, you can set services.xserver.desktopManager.default = "plasma5"; AND services.xserver.windowManager.default = "i3"; to get that variant by default. 946 | 947 | # 948 | # 949 | # 950 | 951 | # extraInit = '' 952 | # shellInit = '' 953 | # if [ -n "$DISPLAY" ]; then 954 | # BROWSER=firefox 955 | # else 956 | # BROWSER=w3m 957 | # fi 958 | # ''; 959 | 960 | }; 961 | 962 | # https://consoledonottrack.com/ 963 | environment.variables = { 964 | DO_NOT_TRACK = "1"; 965 | GATSBY_TELEMETRY_DISABLED = "1"; 966 | HOMEBREW_NO_ANALYTICS = "1"; 967 | STNOUPGRADE = "1"; 968 | DOTNET_CLI_TELEMETRY_OPTOUT = "1"; 969 | SAM_CLI_TELEMETRY = "0"; 970 | AZURE_CORE_COLLECT_TELEMETRY = "0"; 971 | }; 972 | 973 | environment.sessionVariables = { 974 | # EDITOR = "edit"; 975 | BROWSER = "qutebrowser"; 976 | PAGER = "less"; 977 | LESS = "-isMR"; 978 | NIX_PAGER = "bat"; 979 | TERMCMD = "alacritty"; 980 | TERM = "alacritty"; 981 | TERM_PROGRAM = "alacritty"; 982 | # ROFI_SYSTEMD_TERM = "alacritty -e"; 983 | # ROFI_SYSTEMD_TERM = "${pkgs.wezterm}/bin/wezterm"; 984 | NIXPKGS = "/home/bart/source/nixpkgs/"; 985 | NIXPKGS_ALL = "/home/bart/source/nixpkgs/pkgs/top-level/all-packages.nix"; 986 | # GIT_SSL_CAINFO = 987 | # "/etc/ssl/certs/ca-certificates.crt"; # TODO still needed? https://github.com/NixOS/nixpkgs/pull/96763 988 | XDG_DATA_HOME = "$HOME/.local/share"; 989 | TERMINFO_DIRS = "/run/current-system/sw/share/terminfo"; 990 | RANGER_LOAD_DEFAULT_RC = "FALSE"; 991 | FZF_DEFAULT_COMMAND = "fd --type f --hidden --follow --exclude .git"; 992 | # FZF_DEFAULT_OPTS = '' 993 | # \ 994 | # --exact \ 995 | # --reverse \ 996 | # --cycle \ 997 | # --multi \ 998 | # --select-1 \ 999 | # --exit-0 \ 1000 | # --no-height \ 1001 | # --ansi \ 1002 | # --bind=alt-z:toggle-preview \ 1003 | # --bind=alt-w:toggle-preview-wrap \ 1004 | # --bind=alt-s:toggle-sort \ 1005 | # --bind=alt-a:toggle-all \ 1006 | # --bind=ctrl-a:select-all \ 1007 | # --bind 'alt-y:execute:realpath {} | xclip' \ 1008 | # --preview='~/.local/bin/preview.sh {}' \ 1009 | # --header 'alt-z:toggle-preview alt-w:toggle-preview-wrap alt-s:toggle-sort alt-a:toggle-all ctrl-a:select-all alt-y:yank path' 1010 | # ''; 1011 | # _FZF_ZSH_PREVIEW_STRING = 1012 | # "echo {} | sed 's/ *[0-9]* *//' | highlight --syntax=zsh --out-format=ansi"; 1013 | 1014 | # FZF_CTRL_R_OPTS = "--preview $_FZF_ZSH_PREVIEW_STRING --preview-window down:10:wrap"; 1015 | 1016 | FZF_ALT_C_COMMAND = "bfs -color -type d"; 1017 | FZF_ALT_C_OPTS = "--preview 'tree -L 4 -d -C --noreport -C {} | head -200'"; 1018 | # set locales for everything but LANG 1019 | # TODO: nix specific: https://www.reddit.com/r/NixOS/comments/dck6o1/how_to_change_locale_settings/ 1020 | # See i18n.extraLocaleSettings. You can search for "locale" in man configuration.nix. 1021 | # exceptions & info https://unix.stackexchange.com/questions/149111/what-should-i-set-my-locale-to-and-what-are-the-implications-of-doing-so 1022 | LANGUAGE = "en_US.UTF-8"; 1023 | LC_ALL = "en_US.UTF-8"; 1024 | LC_CTYPE = "nl_NL.UTF-8"; 1025 | # LC_NUMERIC="nl_NL.UTF-8"; 1026 | # LC_TIME = "nl_NL.UTF-8"; 1027 | # LC_COLLATE="nl_NL.UTF-8"; 1028 | LC_MONETARY = "nl_NL.UTF-8"; 1029 | # LC_MESSAGES="nl_NL.UTF-8"; 1030 | LC_PAPER = "nl_NL.UTF-8"; 1031 | LC_NAME = "nl_NL.UTF-8"; 1032 | LC_ADDRESS = "nl_NL.UTF-8"; 1033 | LC_TELEPHONE = "nl_NL.UTF-8"; 1034 | LC_MEASUREMENT = "nl_NL.UTF-8"; 1035 | LC_IDENTIFICATION = "nl_NL.UTF-8"; 1036 | }; 1037 | 1038 | # shellAliases = { ll = "ls -l"; }; 1039 | 1040 | #alias vim="stty stop ''' -ixoff; vim" 1041 | # systemd.user.services.udiskie = { 1042 | # unitConfig = { 1043 | # Description = "udiskie mount daemon"; 1044 | # After = [ "graphical-session-pre.target" ]; 1045 | # PartOf = [ "graphical-session.target" ]; 1046 | # }; 1047 | 1048 | # serviceConfig = { 1049 | # ExecStart = "${pkgs.udiskie}/bin/udiskie -t"; 1050 | # Restart = "always"; 1051 | # }; 1052 | 1053 | # wantedBy = [ "graphical-session.target" ]; 1054 | # }; 1055 | 1056 | systemd.user.services."autocutsel" = { 1057 | enable = true; 1058 | description = "AutoCutSel clipboard manager daemon"; 1059 | wantedBy = [ "graphical-session.target" ]; 1060 | serviceConfig = { 1061 | Type = "forking"; 1062 | Restart = "always"; 1063 | RestartSec = 2; 1064 | ExecStartPre = "${pkgs.autocutsel}/bin/autocutsel -fork"; 1065 | ExecStart = "${pkgs.autocutsel}/bin/autocutsel -selection PRIMARY -fork"; 1066 | }; 1067 | }; 1068 | 1069 | # systemd.user.services.clipster = { 1070 | # unitConfig = { 1071 | # Description = "clipster clipboard manager daemon"; 1072 | # After = [ "graphical-session-pre.target" ]; 1073 | # PartOf = [ "graphical-session.target" ]; 1074 | # pidfile = "/var/run/clipster/pid"; 1075 | # }; 1076 | # serviceConfig = { 1077 | # ExecStart = "${pkgs.clipster}/bin/clipster -d"; 1078 | # Restart = "always"; 1079 | # }; 1080 | # wantedBy = [ "graphical-session.target" ]; 1081 | # }; 1082 | 1083 | systemd.user.services.dunst = { 1084 | unitConfig = { 1085 | Description = "dunst notification daemon"; 1086 | After = [ "graphical-session-pre.target" ]; 1087 | PartOf = [ "graphical-session.target" ]; 1088 | }; 1089 | serviceConfig = { 1090 | ExecStart = "${pkgs.dunst}/bin/dunst"; 1091 | Restart = "always"; 1092 | }; 1093 | wantedBy = [ "graphical-session.target" ]; 1094 | }; 1095 | 1096 | systemd.services.audio-off = { 1097 | description = "Mute audio before suspend"; 1098 | wantedBy = [ "sleep.target" ]; 1099 | serviceConfig = { 1100 | Type = "oneshot"; 1101 | Environment = "XDG_RUNTIME_DIR=/run/user/1001"; 1102 | User = "bart"; 1103 | RemainAfterExit = "yes"; 1104 | ExecStart = "${pkgs.alsa-utils}/bin/amixer -q -c 0 set Master mute"; 1105 | }; 1106 | }; 1107 | 1108 | powerManagement.powerDownCommands = "${pkgs.light}/bin/light -O"; 1109 | powerManagement.powerUpCommands = "${pkgs.light}/bin/light -I"; 1110 | 1111 | # xdg.portal = { 1112 | # enable = true; 1113 | # extraPortals = [ 1114 | # xdg-desktop-portal-termfilechooser 1115 | # ]; 1116 | # xdgOpenUsePortal = true; 1117 | # config.common.default = "*"; 1118 | # }; 1119 | 1120 | # programs.nix-ld.enable = true; 1121 | # programs.nix-ld.libraries = with pkgs; [ 1122 | # # Add any missing dynamic libraries for unpackaged programs 1123 | # # here, NOT in environment.systemPackages 1124 | # xorg.libICE 1125 | 1126 | # # dotnetPkg 1127 | 1128 | # # stdenv.cc.cc 1129 | # zlib 1130 | # openssl 1131 | # icu 1132 | # glibc 1133 | # glib 1134 | # libunwind 1135 | 1136 | # # Avalonia (X11 backend) deps — these FIX your error: 1137 | # xorg.libX11 1138 | # xorg.libXcursor 1139 | # xorg.libXext 1140 | # xorg.libXi 1141 | # xorg.libXrandr 1142 | # xorg.libXrender 1143 | # xorg.libXtst 1144 | # xorg.libXfixes 1145 | 1146 | # xorg.libSM 1147 | # gcc.cc.lib # provides libstdc++.so.6 1148 | # ]; 1149 | 1150 | programs = { 1151 | 1152 | fish = { 1153 | enable = true; 1154 | promptInit = '' 1155 | nix-your-shell fish | source 1156 | ''; 1157 | }; 1158 | 1159 | zoxide.enable = true; 1160 | 1161 | neovim.enable = true; 1162 | neovim.defaultEditor = true; 1163 | 1164 | # zsh has an annoying default config which I don't want 1165 | # so to make it work well I have to turn it off first. 1166 | zsh = { 1167 | enable = true; 1168 | # shellInit = ""; 1169 | # shellAliases = { }; 1170 | # promptInit = ""; 1171 | # loginShellInit = ""; 1172 | # debug with: 1173 | # nix-instantiate --eval '' -A config.programs.zsh.interactiveShellInit --json | jq -r | bat 1174 | interactiveShellInit = '' 1175 | ##################################################################### 1176 | # shell independent prompts ######################################### 1177 | ##################################################################### 1178 | 1179 | # Read a single char from /dev/tty, prompting with "$*" 1180 | # Note: pressing enter will return a null string. Perhaps a version terminated with X and then remove it in caller? 1181 | # See https://unix.stackexchange.com/a/367880/143394 for dealing with multi-byte, etc. 1182 | function get_keypress { 1183 | local REPLY IFS= 1184 | >/dev/tty printf '%s' "$*" 1185 | [[ $ZSH_VERSION ]] && read -rk1 # Use -u0 to read from STDIN 1186 | # See https://unix.stackexchange.com/q/383197/143394 regarding '\n' -> ''' 1187 | [[ $BASH_VERSION ]] && 1211 | # Usage: confirm "Dangerous. Are you sure?" && rm * 1212 | function confirm { 1213 | local prompt="''${*:-Are you sure} [y/N]? " 1214 | get_yes_keypress "$prompt" 1 1215 | } 1216 | 1217 | # Prompt to confirm, defaulting to YES on 1218 | function confirm_yes { 1219 | local prompt="''${*:-Are you sure} [Y/n]? " 1220 | get_yes_keypress "$prompt" 0 1221 | } 1222 | ##################################################################### 1223 | ##################################################################### 1224 | ##################################################################### 1225 | 1226 | alias up='unbuffer nixos-rebuild test --upgrade |& nom ' 1227 | alias no=nixos-option 1228 | function upn { 1229 | cd $NIXPKGS && 1230 | if [[ $(git status --porcelain ) == "" ]]; 1231 | then 1232 | echo "checking out commit " $(nixos-version --hash) " under branch name " $(nixos-version | cut -d" " -f1) 1233 | git fetch upstream && git checkout $(nixos-version --hash) -b $(nixos-version | cut -d" " -f1) 1234 | else 1235 | git status 1236 | fi 1237 | } 1238 | alias gcn='cd $NIXPKGS && git checkout $(nixos-version | cut -d" " -f1)' 1239 | alias te='unbuffer nixos-rebuild build -p rt -I nixos-config=/home/bart/nixosConfig/machines/$(hostname | cut -d"-" -f1)/rt.nix |& nom && unbuffer nixos-rebuild test |& nom' 1240 | alias ten='unbuffer nixos-rebuild build -p rt -I nixos-config=/home/bart/nixosConfig/machines/$(hostname | cut -d"-" -f1)/rt.nix -I nixpkgs=$NIXPKGS|& nom && unbuffer nixos-rebuild test -I nixpkgs=$NIXPKGS |& nom' 1241 | alias sw='unbuffer nixos-rebuild boot -p rt -I nixos-config=/home/bart/nixosConfig/machines/$(hostname | cut -d"-" -f1)/rt.nix |& nom && unbuffer nixos-rebuild switch |& nom' 1242 | alias swn='unbuffer nixos-rebuild boot -p rt -I nixos-config=/home/bart/nixosConfig/machines/$(hostname | cut -d"-" -f1)/rt.nix -I nixpkgs=$NIXPKGS |& nom && unbuffer nixos-rebuild switch -I nixpkgs=$NIXPKGS |& nom' 1243 | 1244 | nga() { 1245 | if confirm "Delete all generations and vacuum the systemd journal?"; then 1246 | nix-collect-garbage -d && journalctl --vacuum-time=2d 1247 | else 1248 | echo "\nOK, we'll keep it all" 1249 | fi 1250 | } 1251 | 1252 | ngd() { 1253 | if [[ -n "$1" ]] && [[ "$1" =~ ^-?[0-9]+$ ]]; then 1254 | if confirm "Delete all generations and vacuum the systemd journal except for the last $1 days?"; then 1255 | nix-collect-garbage --delete-older-than $1d && journalctl --vacuum-time=$1d 1256 | else 1257 | echo "\nOK, we'll keep it all." 1258 | fi 1259 | else 1260 | echo "\nYou need to give the number of days you want to keep!" 1261 | fi 1262 | } 1263 | 1264 | lg() { 1265 | echo "System generations\n" 1266 | nix-env -p /nix/var/nix/profiles/system --list-generations 1267 | echo "\n\nRT generations:\n" 1268 | nix-env -p /nix/var/nix/profiles/system-profiles/rt --list-generations 1269 | } 1270 | 1271 | lgs() { 1272 | echo "System generations\n" 1273 | nix-env -p /nix/var/nix/profiles/system --list-generations 1274 | } 1275 | 1276 | lgr() { 1277 | echo "RT generations:\n" 1278 | nix-env -p /nix/var/nix/profiles/system-profiles/rt --list-generations 1279 | } 1280 | 1281 | dgs() { 1282 | if [[ -n "$@" ]] 1283 | for i in "$@" 1284 | do 1285 | if [[ "$i" =~ ^-?[0-9]+$ ]]; then 1286 | 1287 | else 1288 | echo "\nYou need to tell me which generations to delete!" 1289 | kill -INT $$ 1290 | fi 1291 | done 1292 | confirm "Delete system generations $@" && 1293 | nix-env -p /nix/var/nix/profiles/system --delete-generations $@ 1294 | } 1295 | 1296 | dgr() { 1297 | if [[ -n "$@" ]] 1298 | for i in "$@" 1299 | do 1300 | if [[ "$i" =~ ^-?[0-9]+$ ]]; then 1301 | 1302 | else 1303 | echo "\nYou need to tell me which generations to delete!" 1304 | kill -INT $$ 1305 | fi 1306 | done 1307 | confirm "Delete realtime generations $@" && 1308 | nix-env -p /nix/var/nix/profiles/system-profiles/rt --delete-generations $@ 1309 | } 1310 | 1311 | alias ns='nix-shell --command zsh $NIXPKGS' 1312 | alias nsn='nix-shell -I nixpkgs=$NIXPKGS --command zsh' 1313 | # this will leave the build directory behind for you to inspect: 1314 | # alias nb='nix-build -K -A $1 $(pwd)' 1315 | # doesn't work, this one does: 1316 | # nix-build -K -E "with import {}; callPackage ./default.nix {}" 1317 | alias man=batman 1318 | 1319 | # vi() {emacseditor --create-frame --quiet --no-wait "$@"} 1320 | # export EDITOR="vi" 1321 | 1322 | ''; 1323 | }; 1324 | # yazi = { 1325 | # enable = false; 1326 | # settings.yazi = { 1327 | # manager = { 1328 | # ratio = [ 1329 | # 1 1330 | # 2 1331 | # 3 1332 | # ]; 1333 | # sort_by = "mtime"; 1334 | # sort_dir_first = true; 1335 | # sort_sensitive = false; 1336 | # sort_reverse = true; 1337 | # show_hidden = false; 1338 | # show_symlink = true; 1339 | # }; 1340 | # preview = { 1341 | # max_width = 1300; 1342 | # max_height = 1500; 1343 | # cache_dir = ""; 1344 | # }; 1345 | # }; 1346 | # }; 1347 | 1348 | command-not-found.enable = true; 1349 | 1350 | ssh = { 1351 | # startAgent = true; 1352 | # Disable annoying GUI password popup and console error message when using ssh 1353 | askPassword = ""; 1354 | }; 1355 | 1356 | gnupg.agent.enable = true; 1357 | 1358 | chromium = { 1359 | enable = true; 1360 | # Imperatively installed extensions will seamlessly merge with these. 1361 | # Removing extensions here will remove them from chromium, no matter how 1362 | # they were installed. 1363 | defaultSearchProviderSearchURL = "https://duckduckgo.com/?q={searchTerms}"; 1364 | extensions = [ 1365 | # "naepdomgkenhinolocfifgehidddafch" # browserpass-ce 1366 | # "dbepggeogbaibhgnhhndojpepiihcmeb" # vimium 1367 | "pkehgijcmpdhfbdbbnkijodmdjhbjlgp" # privacy badger 1368 | "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere 1369 | "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin 1370 | "ldpochfccmkkmhdbclfhpagapcfdljkj" # Decentraleyes 1371 | # "cmedhionkhpnakcndndgjdbohmhepckk" # Adblock for Youtube™ 1372 | # "gfbliohnnapiefjpjlpjnehglfpaknnc" # Surfingkeys 1373 | # "ignpacbgnbnkaiooknalneoeladjnfgb" # Url in title 1374 | "poahndpaaanbpbeafbkploiobpiiieko" # Display anchors 1375 | "klbibkeccnjlkjkiokjodocebajanakg" # the great suspender 1376 | # "kajibbejlbohfaggdiogboambcijhkke" # mailvelope 1377 | ]; 1378 | extraOpts = { 1379 | DefaultSearchProviderEnabled = true; 1380 | DefaultSearchProviderName = "DuckDuckGo"; 1381 | PasswordManagerEnabled = false; 1382 | BrowserSignin = 0; 1383 | AudioCaptureAllowed = false; 1384 | RestoreOnStartup = 5; 1385 | NetworkPredictionOptions = 2; 1386 | SafeBrowsingEnabled = true; 1387 | SafeBrowsingExtendedReportingEnabled = false; 1388 | SearchSuggestEnabled = false; 1389 | }; 1390 | }; 1391 | 1392 | direnv.enable = true; 1393 | 1394 | light.enable = true; 1395 | # gtk search: 1396 | # plotinus.enable = true; 1397 | # Android Debug Bridge 1398 | # adb.enable = true; 1399 | # for zrythm, see: https://github.com/NixOS/nixpkgs/issues/85546 1400 | dconf.enable = true; 1401 | # dconf.profiles.user = pkgs.writeText "dconf-user-profile" '' 1402 | # user-db:user 1403 | # system-db:local 1404 | # ''; 1405 | television = { 1406 | enable = true; 1407 | enableZshIntegration = true; 1408 | }; 1409 | }; 1410 | 1411 | xdg.sounds.enable = false; 1412 | 1413 | # Define fonts 1414 | fonts = { 1415 | fontDir.enable = true; 1416 | fontconfig = { 1417 | # for bitmap fonts in alacritty 1418 | localConf = '' 1419 | 1420 | 1421 | 1422 | 1423 | 1424 | 1425 | false 1426 | 1427 | 1428 | 1429 | 1430 | ''; 1431 | 1432 | defaultFonts = { 1433 | emoji = [ "Noto Color Emoji" ]; 1434 | monospace = [ "IBM Plex Mono" ]; 1435 | sansSerif = [ "IBM Plex Sans" ]; 1436 | serif = [ "IBM Plex Serif" ]; 1437 | }; 1438 | # penultimate.enable = true; 1439 | # allowType1 = true; 1440 | useEmbeddedBitmaps = true; # pango doesn't support mixing bitmap fonts with ttf anymore, so we if we want terminus plus icons we need terminus_font_ttf for i3bar, which displays wonky without this 1441 | }; 1442 | packages = with pkgs; [ 1443 | terminus_font 1444 | siji # bitmap icons 1445 | terminus_font_ttf 1446 | ibm-plex 1447 | font-awesome_4 1448 | 1449 | # pkgs.nerd-fonts.droid-sans-mono 1450 | nerd-fonts.droid-sans-mono 1451 | nerd-fonts.terminess-ttf 1452 | nerd-fonts.liberation 1453 | nerd-fonts.noto 1454 | nerd-fonts.fira-code 1455 | nerd-fonts.symbols-only # for doom 1456 | # emacs-all-the-icons-fonts 1457 | 1458 | # google-fonts 1459 | # liberation_ttf 1460 | # ibm-plex 1461 | # core-fonts 1462 | corefonts # for svg rendering of faust files in yazi: https://github.com/sxyazi/yazi/issues/3344#issuecomment-3555004395 1463 | ]; 1464 | }; 1465 | 1466 | console = { 1467 | # packages = [ pkgs.terminus_font ]; 1468 | # font = "${pkgs.terminus_font}/share/consolefonts/ter-v12n.psf.gz"; 1469 | font = null; 1470 | # Configure the virtual console keymap from the xserver keyboard settings 1471 | useXkbConfig = true; 1472 | # solarized light 1473 | colors = [ 1474 | "eee8d5" 1475 | "dc322f" 1476 | "859900" 1477 | "b58900" 1478 | "268bd2" 1479 | "d33682" 1480 | "2aa198" 1481 | "073642" 1482 | "002b36" 1483 | "cb4b16" 1484 | "586e75" 1485 | "839496" 1486 | "657b83" 1487 | "6c71c4" 1488 | "586e75" 1489 | "002b36" 1490 | ]; 1491 | # solarized dark 1492 | # colors = [ "839496" "93a1a1" "eee8d5" "2aa198" "fdf6e3" "859900" "d33682" "dc322f" "657b83" "586e75" "cb4b16" "073642" "268bd2" "b58900" "002b36" "6c71c4" ]; 1493 | # setup pretty console ASAP (in initrd). 1494 | earlySetup = true; 1495 | }; 1496 | i18n = { 1497 | defaultLocale = "en_US.UTF-8"; 1498 | }; 1499 | 1500 | networking = { 1501 | # firewall.enable = false; 1502 | # resolvconf.dnsExtensionMechanism = 1503 | # false; # workaround to fix “WiFi in de Trein” 1504 | # resolvconf.dnsExtensionMechanism = false; 1505 | }; 1506 | 1507 | time.timeZone = "Europe/Amsterdam"; 1508 | 1509 | users = { 1510 | defaultUserShell = pkgs.fish; 1511 | # defaultUserShell = pkgs.bashInteractive; 1512 | users.bart = { 1513 | name = "bart"; 1514 | group = "users"; 1515 | # uid = 1000; 1516 | createHome = false; 1517 | home = "/home/bart"; 1518 | extraGroups = [ 1519 | "wheel" 1520 | "audio" 1521 | "jackaudio" 1522 | "video" 1523 | "usbmux" 1524 | "networkmanager" 1525 | "adbusers" 1526 | "libvirtd" 1527 | "camera" 1528 | # "vboxusers" 1529 | "docker" 1530 | ]; 1531 | shell = pkgs.fish; 1532 | # shell = pkgs.bashInteractive; 1533 | isNormalUser = true; 1534 | }; 1535 | mutableUsers = true; 1536 | }; 1537 | 1538 | # tlp still asks for a password 1539 | security.sudo.extraConfig = '' 1540 | bart ALL=(ALL) NOPASSWD: ${pkgs.iotop}/bin/iotop 1541 | bart ALL=(ALL) NOPASSWD: ${pkgs.tlp}/bin/tlp 1542 | ''; 1543 | # bart ALL=(ALL) NOPASSWD: ${pkgs.physlock}/bin/physlock 1544 | 1545 | security.pam.loginLimits = [ 1546 | { 1547 | domain = "@audio"; 1548 | item = "memlock"; 1549 | type = "-"; 1550 | value = "unlimited"; 1551 | } 1552 | { 1553 | domain = "@audio"; 1554 | item = "rtprio"; 1555 | type = "-"; 1556 | value = "99"; 1557 | } 1558 | { 1559 | domain = "@audio"; 1560 | item = "nofile"; 1561 | type = "soft"; 1562 | value = "99999"; 1563 | } 1564 | { 1565 | domain = "@audio"; 1566 | item = "nofile"; 1567 | type = "hard"; 1568 | value = "99999"; 1569 | } 1570 | ]; 1571 | 1572 | } 1573 | --------------------------------------------------------------------------------