[ # Include the results of the hardware scan.
./hardware-configuration.nix
inputs.home-manager.nixosModules.default
+ inputs.extra-container.nixosModules.default
+ inputs.microvm.nixosModules.host
];
# Bootloader.
boot.initrd.kernelModules = [ "amdgpu" ];
boot.consoleLogLevel = 0;
boot.kernelPackages = pkgs.linuxPackages_latest;
- boot.kernelParams = [ "quiet" "udev.log_level=0" "amdgpu.runpm=0" ];
-
- networking.hostName = "nixos"; # Define your hostname.
+ boot.kernelParams = [ "quiet" "udev.log_level=0" "amdgpu.runpm=0" ];
+
+ # incus admin init --minimal
+ # incus image list images:
+ # incus launch images:ubuntu/noble <name>
+ # incus exec <name> -- /bin/bash
+ # incus exec <name> -- adduser --shell /bin/bash --ingroup sudo ps
+ # incus exec <name> -- su - ps -c 'tmux new-session -A -s main'
+ virtualisation.incus.enable = true;
+ virtualisation.incus.ui.enable = true;
+ networking.nftables.enable = true;
+ networking.firewall.trustedInterfaces = [ "incusbr0" ];
+
+ networking.hostName = "thinkpad"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.download-buffer-size = 500000000;
- nix.package = pkgs.nixVersions.nix_2_28;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
programs.dconf.enable = true;
programs.steam.enable = true;
+ # Containers
+ containers = {
+ im = {
+ ephemeral = true;
+ # privateNetwork = true;
+ localAddress = "10.23.45.2";
+ hostAddress = "10.23.45.1";
+
+ bindMounts."/per".hostPath = "/var/lib/nixos-containers/im";
+ bindMounts."/per".isReadOnly = false;
+
+ extraFlags = [
+ "--property='MemoryMax=60M'"
+ "--property='MemoryHigh=50M'"
+ "--property='CPUQuota=4%'"
+ ];
+
+ config = { config, pkgs, ... }: {
+ imports = [ inputs.impermanence.nixosModules.impermanence ];
+
+ environment.persistence."/per" = {
+ directories = [
+ "/var/log"
+ "/var/lib"
+ { directory = "/home/ps"; user = "ps"; group = "users"; mode = "0750"; }
+ ];
+ files = [];
+ };
+ environment.systemPackages = with pkgs; [ helix python312 deno ];
+
+ users.users.ps = { isNormalUser = true; };
+
+ networking.firewall.allowedTCPPorts = [ 80 8080 ];
+
+ system.stateVersion = "25.05";
+ };
+ };
+ };
+ networking.nat.enable = true;
+ networking.nat.internalInterfaces = ["ve-+"];
+ networking.nat.externalInterface = "eth0";
+ networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
+
# Services
services = {
-
+ displayManager = {
+ defaultSession = "xfce+i3";
+ };
xserver = {
enable = true;
- # Enable the GNOME Desktop Environment.
- # displayManager.gdm.enable = true;
- # desktopManager.gnome.enable = true;
-
- # displayManager.sddm.enable = true;
- # desktopManager.budgie.enable = true;
-
- # desktopManager.deepin.enable = true;
- # displayManager.lightdm.enable = true;
-
- # displayManager.gdm.enable = true;
- # desktopManager.plasma5.enable = true;
-
displayManager = {
- defaultSession = "xfce+i3";
lightdm = {
enable = true;
greeters.gtk = {
xterm.enable = false;
xfce = {
enable = true;
- # noDesktop = true;
+ noDesktop = true;
enableXfwm = false;
};
};
dataDir = "/home/ps/sync";
configDir = "/home/ps/.config/syncthing";
};
+
+ services.tlp = {
+ enable = true;
+ settings = {
+ CPU_SCALING_GOVERNOR_ON_AC = "performance";
+ CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
+
+ CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance";
+ CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
+
+ PLATFORM_PROFILE_ON_AC = "balanced";
+ PLATFORM_PROFILE_ON_BAT = "low-power";
+
+ CPU_BOOST_ON_AC = "1";
+ CPU_BOOST_ON_BAT = "0";
+
+ AMDGPU_ABM_LEVEL_ON_AC = "0";
+ AMDGPU_ABM_LEVEL_ON_BAT = "3";
+
+ CPU_MIN_PERF_ON_AC = 0;
+ CPU_MAX_PERF_ON_AC = 100;
+ CPU_MIN_PERF_ON_BAT = 0;
+ CPU_MAX_PERF_ON_BAT = 20;
+
+ START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge
+ STOP_CHARGE_THRESH_BAT0 = 85; # 85 and above it stops charging
+ };
+ };
services.udev.extraRules = ''
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
'';
# OpenGL
- # hardware.graphics.enable = true;
hardware = {
graphics = {
enable = true;
enable = true;
support32Bit.enable = true;
};
-};
+ };
# services.logind = {
# extraConfig = "HandlePowerKey=suspend";
services.printing.enable = true;
services.printing.drivers = [ pkgs.gutenprint ];
+ # Enable scanners
+ hardware.sane.enable = true;
+ hardware.sane.extraBackends = [ pkgs.hplipWithPlugin pkgs.sane-airscan ];
+ services.avahi.enable = true;
+ services.avahi.nssmdns4 = true;
+ services.avahi.reflector = true;
+ services.udev.packages = [ pkgs.sane-airscan ];
+
# Enable Bluetooth
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = false;
services.blueman.enable = true;
# Enable sound with pipewire.
- hardware.pulseaudio.enable = false;
+ services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
isNormalUser = true;
description = "Patrick";
shell = pkgs.bash;
- extraGroups = [ "networkmanager" "wheel" "dialout" "jackaudio" ];
+ extraGroups = [ "networkmanager" "wheel" "dialout" "jackaudio" "lp" "incus-admin" ];
};
sshd = {
isSystemUser = true;
pavucontrol
syncthingtray
# xfce plugins
+ xfce.xfce4-panel
xfce.xfce4-pulseaudio-plugin
# xfce.xfce4-verve-plugin
xfce.xfce4-notes-plugin
{
"nodes": {
+ "extra-container": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1749474221,
+ "narHash": "sha256-t31Ynq9jFNlf3lUQ8vvdJKt7xQqo5poWi+3yl2v8avk=",
+ "owner": "erikarvstedt",
+ "repo": "extra-container",
+ "rev": "6a6d1d32fde689c2ea978c1c1a4286e89f4f83c1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "erikarvstedt",
+ "repo": "extra-container",
+ "type": "github"
+ }
+ },
"firefox-addons": {
"inputs": {
"nixpkgs": [
},
"locked": {
"dir": "pkgs/firefox-addons",
- "lastModified": 1749441800,
- "narHash": "sha256-bN4tccrmczfR4PUuepHpxNNmWG3cLZTFIt4BaD8YyvA=",
+ "lastModified": 1751515409,
+ "narHash": "sha256-yu+/TxHkuZ8GHKwpKTv1BpfbYD1wH1CyPsOmY72chTg=",
"owner": "rycee",
"repo": "nur-expressions",
- "rev": "fe13e6abfe72b39ad8381595c3c404849330c3cb",
+ "rev": "2e0dcafe8c48470e036908f34a2a1413f75bd804",
"type": "gitlab"
},
"original": {
"type": "github"
}
},
+ "flake-utils_2": {
+ "inputs": {
+ "systems": "systems_2"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "flake-utils_3": {
+ "inputs": {
+ "systems": "systems_3"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
"home-manager": {
"inputs": {
"nixpkgs": [
]
},
"locked": {
- "lastModified": 1747688870,
- "narHash": "sha256-ypL9WAZfmJr5V70jEVzqGjjQzF0uCkz+AFQF7n9NmNc=",
+ "lastModified": 1751468302,
+ "narHash": "sha256-tWosziZTT039x6PgEZUhzGlV8oLvdDmIgKTE8ESMaEA=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "d5f1f641b289553927b3801580598d200a501863",
+ "rev": "501cfec8277f931a9c9af9f23d3105c537faeafe",
"type": "github"
},
"original": {
"owner": "nix-community",
- "ref": "release-24.11",
+ "ref": "release-25.05",
"repo": "home-manager",
"type": "github"
}
},
+ "impermanence": {
+ "locked": {
+ "lastModified": 1737831083,
+ "narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
+ "owner": "nix-community",
+ "repo": "impermanence",
+ "rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "impermanence",
+ "type": "github"
+ }
+ },
+ "microvm": {
+ "inputs": {
+ "flake-utils": "flake-utils_2",
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "spectrum": "spectrum"
+ },
+ "locked": {
+ "lastModified": 1750358184,
+ "narHash": "sha256-17EYMeY5v8KRk9HW6Z4dExY8Wg4y/zM2eM2wbbx+vMs=",
+ "owner": "astro",
+ "repo": "microvm.nix",
+ "rev": "fd9f5dba1ffee5ad6f29394b2a9e4c66c1ce77dc",
+ "type": "github"
+ },
+ "original": {
+ "owner": "astro",
+ "repo": "microvm.nix",
+ "type": "github"
+ }
+ },
"nixpkgs": {
"locked": {
- "lastModified": 1749237914,
- "narHash": "sha256-N5waoqWt8aMr/MykZjSErOokYH6rOsMMXu3UOVH5kiw=",
+ "lastModified": 1751211869,
+ "narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "70c74b02eac46f4e4aa071e45a6189ce0f6d9265",
+ "rev": "b43c397f6c213918d6cfe6e3550abfe79b5d1c51",
"type": "github"
},
"original": {
},
"nixpkgs-unstable": {
"locked": {
- "lastModified": 1749285348,
- "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=",
+ "lastModified": 1751271578,
+ "narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f",
+ "rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
},
"psch-flakes": {
"inputs": {
- "flake-utils": "flake-utils",
+ "flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
- "lastModified": 1746213313,
- "narHash": "sha256-w6X8x4CgqZhK8ZJEZmKc3tL12DYk577UVC05MuALvFE=",
+ "lastModified": 1751534912,
+ "narHash": "sha256-UceGTTox8E1y4QNmsm7nlFXLncIBhPhONTsi6GZfdNA=",
"ref": "refs/heads/main",
- "rev": "352244457cdc7d2af63da2cc04be8c9105c5e2c8",
- "revCount": 8,
+ "rev": "2f75d496563e6b4053f21bd9a66bc4b06b09360c",
+ "revCount": 15,
"type": "git",
"url": "git://psch.dev/flakes"
},
},
"root": {
"inputs": {
+ "extra-container": "extra-container",
"firefox-addons": "firefox-addons",
"home-manager": "home-manager",
+ "impermanence": "impermanence",
+ "microvm": "microvm",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"psch-flakes": "psch-flakes"
}
},
+ "spectrum": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1746869549,
+ "narHash": "sha256-BKZ/yZO/qeLKh9YqVkKB6wJiDQJAZNN5rk5NsMImsWs=",
+ "ref": "refs/heads/main",
+ "rev": "d927e78530892ec8ed389e8fae5f38abee00ad87",
+ "revCount": 862,
+ "type": "git",
+ "url": "https://spectrum-os.org/git/spectrum"
+ },
+ "original": {
+ "type": "git",
+ "url": "https://spectrum-os.org/git/spectrum"
+ }
+ },
"systems": {
"locked": {
"lastModified": 1681028828,
"repo": "default",
"type": "github"
}
+ },
+ "systems_2": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
+ "systems_3": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
}
},
"root": "root",
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
- psch-flakes.url = "git://psch.dev/flakes";
- psch-flakes.inputs.nixpkgs.follows = "nixpkgs";
+ impermanence.url = "github:nix-community/impermanence";
+
+ extra-container = {
+ url = "github:erikarvstedt/extra-container";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ psch-flakes = {
+ url = "git://psch.dev/flakes";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
home-manager = {
- url = "github:nix-community/home-manager/release-24.11";
+ url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
+
+ microvm.url = "github:astro/microvm.nix";
+ microvm.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, ... }@inputs: {
nixosConfigurations.default = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
- modules = [
- ./configuration.nix
- inputs.home-manager.nixosModules.default
- ];
+ modules = [ ./configuration.nix ];
};
};
}
enable = true;
mapExpression = {
Caps_Lock = "Escape";
- Super_L = "Alt_L|F1";
};
};
in lib.mkOptionDefault
{
# "${mod}+d" = "exec --no-startup-id krunner";
- "${mod}+Shift+p" = "exec --no-startup-id set-wallpaper";
+ # "${mod}+Shift+p" = "exec --no-startup-id set-wallpaper";
"${mod}+Shift+Return" = "exec --no-startup-id ${pkgs.kitty}/bin/kitty -d $(${pkgs.xcwd}/bin/xcwd)";
"${mod}+BackSpace" = "kill";
"${mod}+Prior" = "workspace prev_on_output";
"${mod}+Ctrl+Left" = "move workspace to output left";
"${mod}+Ctrl+Right" = "move workspace to output right";
"${mod}+y" = "exec --no-startup-id mirror-phone";
- "${mod}+n" = "exec ${pkgs.kitty}/bin/kitty ${pkgs.helix}/bin/hx -w ~/sync/txt ~/sync/txt";
+ "${mod}+n" = "exec ${pkgs.kitty}/bin/kitty -d ~/sync/txt $EDITOR .";
"${mod}+m" = "exec --no-startup-id i3-msg $(${i3-max})";
"${mod}+Shift+m" = "exec --no-startup-id i3-msg $(${i3-move-max})";
+ "${mod}+Shift+p" = "exec --no-startup-id ${pkgs.autorandr}/bin/autorandr --match-edid -c -f";
};
};
extraConfig = ''
+ exec ${pkgs.xfce.xfce4-panel}/bin/xfce4-panel
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
# for_window [workspace="0"] floating enable
snrs = "sudo nixos-rebuild switch --flake /etc/nixos#default";
snrt = "sudo nixos-rebuild test --flake /etc/nixos#default";
snrb = "sudo nixos-rebuild boot --flake /etc/nixos#default";
- senc = "sudo ${pkgs.helix}/bin/hx /etc/nixos/configuration.nix";
- senh = "sudo ${pkgs.helix}/bin/hx /etc/nixos/home.nix";
+ senc = "sudo $EDITOR /etc/nixos/configuration.nix";
+ senh = "sudo $EDITOR /etc/nixos/home.nix";
+ senf = "sudo $EDITOR /etc/nixos/flake.nix";
flakerun = "nix run --override-input nixpkgs nixpkgs";
+ n = "nvim";
};
};
nvim-lspconfig
blink-cmp
telescope-nvim
- trouble-nvim
+ undotree
+ which-key-nvim
+ guess-indent-nvim
];
extraConfig = ''
set number
set relativenumber
set tabstop=4
set shiftwidth=4
+ set expandtab
set foldmethod=marker
+ set autoindent
+ set smartindent
+ filetype plugin indent on
+ set signcolumn=yes
+
colorscheme habamax
nnoremap <Down> gj
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
tnoremap <Esc> <C-\><C-n>
+ map <Space> <Leader>
+ nnoremap <Esc> :noh<CR>
+ nnoremap <leader>u :UndotreeToggle<CR> :UndotreeFocus<CR>
+ nnoremap <leader>f :Telescope find_files<CR>
+ nnoremap <leader>b :Telescope buffers<CR>
+ nnoremap <leader>e :Telescope diagnostics<CR>
+ nnoremap <leader>g :Telescope live_grep<CR>
+ nnoremap <leader>s :Telescope lsp_document_symbols<CR>
+ nnoremap <leader>r :Telescope lsp_references<CR>
+ nnoremap <leader><S-r> :Telescope lsp_references<CR><C-q>
+ nnoremap <leader>d :Telescope lsp_definitions<CR>
+ noremap <leader>y "+y"<CR>
+ noremap <leader>p "+p"<CR>
+
+ " augroup FormatAutogroup
+ " autocmd!
+ " autocmd BufWritePost * FormatWrite
+ " augroup END
+
+ autocmd BufReadPost *
+ \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
+ \ | exe "normal! g`\""
+ \ | endif
'';
extraLuaConfig = ''
require('lspconfig').zls.setup{}
+ require('lspconfig').clangd.setup{}
+ local util = require('formatter.util')
require('formatter').setup {
-
+ logging = true,
+ log_level = vim.log.levels.WARN,
+ filetype = {
+ c = { require("formatter.filetypes.c").clangformat },
+ cpp = { require("formatter.filetypes.cpp").clangformat },
+ zig = { require("formatter.filetypes.zig").zigfmt },
+ }
+ }
+ require('blink.cmp').setup {
+ keymap = {
+ preset = 'none',
+
+ ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
+ ['<C-e>'] = { 'hide', 'fallback' },
+ ['<CR>'] = { 'accept', 'fallback' },
+
+ ['<Tab>'] = { 'select_next', 'fallback_to_mappings' },
+ ['<S-Tab>'] = { 'select_prev', 'fallback_to_mappings' },
+
+ ['<C-p>'] = { 'scroll_documentation_up', 'fallback' },
+ ['<C-n'] = { 'scroll_documentation_down', 'fallback' },
+
+ ['<C-k>'] = { 'show_signature', 'hide_signature', 'fallback' },
+ },
+ completion = {
+ list = { selection = { preselect = false, } },
+ },
}
'';
};
xarchiver
tig lazygit gitui
thunderbird
+ aerc
libreoffice
gimp
guvcview