diff --git a/flake.lock b/flake.lock deleted file mode 100644 index df4c399..0000000 --- a/flake.lock +++ /dev/null @@ -1,27 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1715266358, - "narHash": "sha256-doPgfj+7FFe9rfzWo1siAV2mVCasW+Bh8I1cToAXEE4=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "f1010e0469db743d14519a1efd37e23f8513d714", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 3ba88ee..0000000 --- a/flake.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ - description = "Nixos config flake"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - - # hyprland.url = "github:hyprwm/Hyprland"; - # hyprland-plugins = { - # url = "github:hyprwm/hyprland-plugins"; - # inputs.hyprland.follows = "hyprland"; - # }; - - # sops-nix = { - # url = "github:Mic92/sops-nix"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; - - # home-manager = { - # url = "github:nix-community/home-manager"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; - }; - - outputs = { - self, - nixpkgs, - ... - } @ inputs: { - inherit self; - nixosConfigurations.default = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = {inherit inputs;}; - modules = [ - ({pkgs, ...}: { - # Let 'nixos-version --json' know about the Git revision - # of this flake. - system.configurationRevision = self.lastModifiedDate; - }) - ./hosts/default/configuration.nix - # inputs.home-manager.nixosModules.default - ]; - }; - }; -} diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix deleted file mode 100644 index f13332e..0000000 --- a/hosts/default/configuration.nix +++ /dev/null @@ -1,350 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). -{ - config, - pkgs, - inputs, - ... -}: let - home-manager = builtins.fetchTarball { - url = "https://github.com/nix-community/home-manager/archive/master.tar.gz"; - sha256 = "0bhwgi7mjrngv1fyv8cl0iwqkn1al7dj65rbw1b6wffrq776x572"; - }; - sops = builtins.fetchTarball { - url = "https://github.com/Mic92/sops-nix/archive/master.tar.gz"; - sha256 = "1wzm5hs3cda6l7q9ls5nw16bifb00v5kan1xcab57bb5fg6qqnyb"; - }; -in { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - # inputs.home-manager.nixosModules.default - (import "${home-manager}/nixos") - (import "${sops}/modules/sops") - # Secrets Manager - # inputs.sops-nix.nixosModules.sops - ]; - - sops.validateSopsFiles = false; - sops.defaultSopsFile = "/etc/nixos/secrets/secrets.yaml"; - sops.defaultSopsFormat = "yaml"; - sops.age.keyFile = "/home/itsscb/.config/sops/age/keys.txt"; - - sops.secrets."nas" = { - owner = config.users.users.itsscb.name; - }; - sops.secrets."git" = { - owner = config.users.users.itsscb.name; - path = "${config.users.users.itsscb.home}/.config/git/credentials"; - }; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - boot.initrd.luks.devices."luks-ddb552e7-c477-4d71-899b-9224d6782b9f".device = "/dev/disk/by-uuid/ddb552e7-c477-4d71-899b-9224d6782b9f"; - networking.hostName = "scbnb"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - nix.settings.experimental-features = ["nix-command" "flakes"]; - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the GNOME Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; - - # Configure keymap in X11 - services.xserver.xkb = { - layout = "us"; - variant = ""; - }; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - - users.groups.fsc = { - gid = 1010; - }; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.itsscb = { - isNormalUser = true; - uid = 1000; - description = "itsscb"; - extraGroups = ["networkmanager" "wheel" "fsc"]; - packages = with pkgs; [ - ]; - }; - users.users."k.sc" = { - isNormalUser = true; - uid = 1001; - description = "k.sc"; - extraGroups = ["networkmanager" "fsc"]; - packages = with pkgs; [ - ]; - }; - - fonts.packages = with pkgs; [ - nerdfonts - ]; - - programs = { - # home-manager = { - # enable = true; - # }; - - # sops-nix = { - # enable = true; - # }; - - steam = { - enable = true; - }; - - hyprland = { - enable = true; - xwayland.enable = true; - }; - - chromium = { - enable = true; - homepageLocation = "https://start.duckduckgo.com"; - extraOpts = { - syncDisabled = true; - BrowserSignin = 0; - PasswordManagerEnabled = false; - SpellcheckEnabled = false; - }; - defaultSearchProviderEnabled = true; - defaultSearchProviderSearchURL = "https://start.duckduckgo.com/?q={searchTerms}"; - }; - }; - - environment = { - sessionVariables = { - WLR_NO_HARDWARE_CURSORS = "1"; - NIXOS_OZONE_WL = "1"; - }; - - variables = { - EDITOR = "hx"; - }; - }; - - hardware = { - opengl.enable = true; - nvidia.modesetting.enable = true; - }; - - home-manager = { - extraSpecialArgs = {inherit inputs;}; - backupFileExtension = "backup"; - users = { - "itsscb" = import ./home.nix; # ( config.sops.secrets."git"); - "root" = { - home.stateVersion = "23.11"; - home.file.".config/helix".source = ../../dotfiles/helix; - programs.bash = { - enable = true; - shellAliases = { - ls = "eza -la --git"; - grep = "rg"; - cat = "bat"; - }; - }; - }; - }; - }; - - nixpkgs.config.allowUnfree = true; - - xdg.portal.enable = true; - - environment.systemPackages = with pkgs; [ - # nix specific - ## Secrets Manager - sops - - ## nix formatter - alejandra - - # Encryption - age - - # Hyprland / Window Manager - xdg-desktop-portal-gtk - xdg-desktop-portal-hyprland - - ## App Starter - rofi-wayland - - ## Network Settings - networkmanagerapplet - - # Audio Settings - pavucontrol - - ## Bluetooth Settings - blueman - - ## Lockscreen - hyprlock - - ## Top Bar - waybar - ( - waybar.overrideAttrs (oldAttrs: { - mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"]; - }) - ) - - ## ??? - dunst - - ## Notification Daemone (?) - libnotify - - ## File Manager - dolphin - breeze-icons - - ## ??? - swww - - # Clipboard Manager - xclip - - # Image Manipulation - inkscape - gimp - - # Video - ffmpeg - vlc - - # Music - spotify - - # Terminal - alacritty - - ## 'ls' replacement - eza - - ## 'cat' replacement - bat - - ## 'grep' replacement - ripgrep - - ## 'find' replacement - fd - - ## Default Tools - curl - gitFull # git - broot # file manager - jq # json tool - poppler # ??? - fzf # ??? - - # Editor - helix - - # Mail Client - thunderbird - ]; - - services.xserver.excludePackages = - (with pkgs; [ - nano - xterm - ]) - ++ (with pkgs.gnome; [ - cheese - gnome-music - epiphany - geary - totem - tali - iagno - hitori - atomix - ]); - - fileSystems = { - "/mnt/home" = { - device = "//192.168.128.2/Cloud_Privat"; - fsType = "cifs"; - label = "HOME"; - options = let - automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; - in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"]; - }; - "/mnt/music" = { - device = "//192.168.128.2/music"; - fsType = "cifs"; - label = "HOME"; - options = let - automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; - in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"]; - }; - "/mnt/scan" = { - device = "//192.168.128.2/scan"; - fsType = "cifs"; - options = let - automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; - in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"]; - }; - "/mnt/shared" = { - device = "//192.168.128.2/shared"; - fsType = "cifs"; - options = let - automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; - in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"]; - }; - }; - - programs.nix-ld.enable = true; - programs.nix-ld.libraries = with pkgs; [ - # Add any missing dynamic libraries for unpackaged - # programs here, NOT in environment.systemPackages - ]; - - system.stateVersion = "23.11"; # Did you read the comment? -} diff --git a/hosts/default/hardware-configuration.nix b/hosts/default/hardware-configuration.nix deleted file mode 100644 index 2fa7f19..0000000 --- a/hosts/default/hardware-configuration.nix +++ /dev/null @@ -1,46 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/b57531b3-bf78-466e-a2f7-7eab09ce9284"; - fsType = "ext4"; - }; - - boot.initrd.luks.devices."luks-1ed60977-b0ee-4751-99f3-05f0b224634b".device = "/dev/disk/by-uuid/1ed60977-b0ee-4751-99f3-05f0b224634b"; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/59A3-0BC5"; - fsType = "vfat"; - options = ["fmask=0022" "dmask=0022"]; - }; - - swapDevices = [ - {device = "/dev/disk/by-uuid/968cd561-fb73-496a-a37a-0e662bf45597";} - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp59s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/default/home.nix b/hosts/default/home.nix deleted file mode 100644 index 67ba549..0000000 --- a/hosts/default/home.nix +++ /dev/null @@ -1,285 +0,0 @@ -{ - config, - pkgs, - inputs, - ... -}: { - home.username = "itsscb"; - home.homeDirectory = "/home/itsscb"; - - home.stateVersion = "23.11"; # Please read the comment before changing. - - programs = { - helix = { - enable = true; - defaultEditor = true; - settings = { - theme = "onedark"; - editor = { - line-number = "relative"; - bufferline = "multiple"; - auto-completion = true; - auto-save = true; - auto-format = true; - cursorline = true; - gutters = [ - "diff" - "diagnostics" - "line-numbers" - "spacer" - ]; - text-width = 80; - cursor-shape = { - insert = "bar"; - normal = "block"; - select = "underline"; - }; - - statusline = { - left = [ - "mode" - "spinner" - "file-modification-indicator" - "read-only-indicator" - ]; - - center = ["file-name"]; - - right = [ - "diagnostics" - "register" - "selections" - "position" - "file-encoding" - "file-line-ending" - "file-type" - ]; - - separator = "|"; - }; - - lsp = { - enable = true; - auto-signature-help = true; - display-messages = true; - display-inlay-hints = true; - }; - - indent-guides = { - render = true; - character = "┊"; - skip-levels = 1; - }; - }; - keys.insert.j.k = "normal_mode"; - keys.insert."C-c" = "normal_mode"; - - keys.normal.g.a = "code_action"; - keys.normal.backspace = { - r = ":run-shell-command cargo run"; - t = ":run-shell-command cargo test"; - b = ":run-shell-command cargo build"; - c = ":run-shell-command cargo check"; - }; - }; - }; - - bash = { - enable = true; - shellAliases = { - ls = "eza -la --git"; - grep = "rg"; - cat = "bat"; - }; - }; - - git = { - enable = true; - userName = "itsscb"; - userEmail = "dev@itsscb.de"; - extraConfig = { - credential.helper = "store"; - }; - }; - - vim = { - enable = true; - }; - - chromium = { - enable = true; - commandLineArgs = [ - "--disable-default-apps" - "--homepage https://start.duckduckgo.com" - "--start-maximized" - "--enable-features=WebContentsForceDark" - "--force-dark-mode" - ]; - }; - }; - - dconf = { - enable = true; - settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; - settings."org/gnome/desktop/screensaver" = { - picture-uri = "file:///etc/nixos/dotfiles/hypr/rust.png"; - picture-uri-dark = "file:///etc/nixos/dotfiles/hypr/rust.png"; - }; - settings."org/gnome/desktop/peripherals/touchpad".tap-to-click = true; - settings."org/gnome/desktop/background".picture-uri-dark = "file:///run/current-system/sw/share/backgrounds/gnome/keys-d.jpg"; - settings."org/gnome/desktop/background".picture-uri = "file:///run/current-system/sw/share/backgrounds/gnome/keys-l.jpg"; - settings."org/gnome/desktop/background".primary-color = "#aaaaaa"; - settings."org/gnome/desktop/background".secondary-color = "#000000"; - settings."org/gnome/desktop/interface".show-battery-percentage = true; - settings."org/gnome/settings-daemon/plugins/media-keys".home = ["e"]; - settings."org/gnome/settings-daemon/plugins/media-keys".control-center = ["i"]; - settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".binding = "t"; - settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".command = "gnome-terminal"; - settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".name = "gt1"; - - settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".binding = "t"; - settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".command = "gnome-terminal"; - settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".name = "gt2"; - settings."org/gnome/settings-daemon/plugins/media-keys".custom-keybindings = ["/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"]; - }; - home.packages = [ - ]; - wayland.windowManager.hyprland.enable = true; - wayland.windowManager.hyprland.settings = { - exec-once = [ - "swww-daemon" - "swww img /etc/nixos/dotfiles/hypr/rust.png" - "nm-applet --indicator" - "blueman-applet" - "waybar" - "dunst" - ]; - - "$terminal" = "alacritty"; - "$fileManager" = "dolphin"; - "$menu" = "rofi -show drun"; - - "$mod" = "SUPER"; - - monitor = ",preferred,auto,1"; - - general = { - layout = "master"; - gaps_in = 5; - gaps_out = 20; - border_size = 2; - "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; - "col.inactive_border" = "rgba(595959aa)"; - - allow_tearing = false; - }; - - decoration = { - rounding = 10; - - blur = { - enabled = true; - size = 3; - passes = 1; - }; - - drop_shadow = "yes"; - shadow_range = 4; - shadow_render_power = 3; - "col.shadow" = "rgba(1a1a1aee)"; - }; - - animations = { - enabled = "yes"; - - bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; - - animation = [ - "windows, 1, 7, myBezier" - "windowsOut, 1, 7, default, popin 80%" - "border, 1, 10, default" - "borderangle, 1, 8, default" - "fade, 1, 7, default" - "workspaces, 1, 6, default" - ]; - }; - - gestures = { - workspace_swipe = "off"; - }; - - misc = { - force_default_wallpaper = 0; - }; - - windowrulev2 = "suppressevent maximize, class:.*"; - - input = { - follow_mouse = 2; - - touchpad = { - natural_scroll = "yes"; - }; - }; - - master = { - new_is_master = false; - }; - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - - bind = - [ - "$mod, T, exec, $terminal" - "$mod, L, exec, hyprlock" - "$mod, Q, exec, $terminal" - "$mod SHIFT, L, exit" - "$mod, C, killactive" - "$mod, E, exec, $fileManager" - "$mod, V, exec, togglefloating" - "$mod, R, exec, $menu" - "$mod, P, pseudo," - "$mod, O, togglesplit," - "$mod, U, fullscreen," - "$mod, P, focuscurrentorlast," - "$mod, P, movewindow,l" - # "$mod, H, movefocus, l" - # "$mod, K, movefocus, u" - "$mod, J, movefocus, d" - "$mod, S, togglespecialworkspace, magic" - "$mod SHIFT, S, movetoworkspace, special:magic" - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - ] - ++ ( - # workspaces - # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} - builtins.concatLists (builtins.genList ( - x: let - ws = let - c = (x + 1) / 10; - in - builtins.toString (x + 1 - (c * 10)); - in [ - "$mod, ${ws}, workspace, ${toString (x + 1)}" - "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" - ] - ) - 10) - ); - }; - - home.file = { - ".config/hypr/hyprlock.conf".source = ../../dotfiles/hypr/hyprlock.conf; - ".config/waybar".source = ../../dotfiles/waybar; - }; - - home.sessionVariables = { - }; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; -} diff --git a/nixos-rebuild.sh b/nixos-rebuild.sh index 7af7683..cdc25ff 100755 --- a/nixos-rebuild.sh +++ b/nixos-rebuild.sh @@ -7,9 +7,6 @@ if [ -z "$1"] file=$1 fi -# A rebuild script that commits on a successful build -set -e - # cd to your config dir cd /etc/nixos/ @@ -25,6 +22,9 @@ fi sudo rm nixos-switch.log +# A rebuild script that commits on a successful build +set -e + # Autoformat your nix files sudo alejandra . &>/dev/null \ || ( sudo alejandra . ; echo "formatting failed!" && exit 1) @@ -35,15 +35,15 @@ sudo git diff -U0 '*.nix' echo -n "NixOS - Testing new configuration..." # Rebuild, output simplified errors, log trackebacks -sudo nixos-rebuild dry-build --flake .#default &>nixos-switch.log || (cat nixos-switch.log | grep --color error && exit 1) +sudo nixos-rebuild dry-build &>nixos-switch.log || (cat nixos-switch.log | grep --color error && exit 1) echo -e 'KNixOS - Test passed. Adding files to git' sudo git add * echo -e "NixOS - Rebuilding..." -sudo nixos-rebuild dry-build --flake .#default &>nixos-switch.log || (cat nixos-switch.log | grep --color error && sudo git restore --staged ./**/*.nix && cd - && exit 1) +sudo nixos-rebuild switch &>nixos-switch.log || (cat nixos-switch.log | grep --color error && sudo git restore --staged ./**/*.nix && cd - && exit 1) # Get current generation metadata -current=$(sudo nixos-version --json | jq .configurationRevision) +current=$(sudo nixos-rebuild list-generations | grep current) # Commit all changes witih the generation metadata sudo git commit -am "$current"