diff --git a/dotfiles/hyprland.conf b/dotfiles/hyprland.conf index 71e9f65..96a568f 100644 --- a/dotfiles/hyprland.conf +++ b/dotfiles/hyprland.conf @@ -3,7 +3,7 @@ ################ # See https://wiki.hyprland.org/Configuring/Monitors/ -monitor=,preferred,auto,auto +monitor=,preferred,auto,1 ################### ### MY PROGRAMS ### diff --git a/flake.lock b/flake.lock index 1c1f6a2..e2b338d 100644 --- a/flake.lock +++ b/flake.lock @@ -66,6 +66,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738148035, + "narHash": "sha256-KYOATYEwaKysL3HdHdS5kbQMXvzS4iPJzJrML+3TKAo=", + "owner": "nix-community", + "repo": "disko", + "rev": "18d0a984cc2bc82cf61df19523a34ad463aa7f54", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -211,6 +231,7 @@ }, "root": { "inputs": { + "disko": "disko", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "stylix": "stylix" diff --git a/flake.nix b/flake.nix index 9934483..79d67c8 100644 --- a/flake.nix +++ b/flake.nix @@ -8,11 +8,16 @@ inputs.nixpkgs.follows = "nixpkgs"; }; stylix.url = "github:danth/stylix"; + disko = { + "url" = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, + disko, ... }@inputs: let system = "x86_64-linux"; @@ -20,7 +25,7 @@ in { nixosConfigurations = { - home = nixpkgs.lib.nixosSystem { + arcueid = nixpkgs.lib.nixosSystem { specialArgs = { inherit system; inherit inputs; @@ -37,16 +42,23 @@ inputs.home-manager.nixosModules.default ]; }; - work = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; + work-laptop = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs system;}; modules = [ - ./hosts/work/configuration.nix + ./modules/nixos/cli-environment.nix + ./modules/nixos/dev-environment.nix + ./modules/nixos/fonts.nix + ./modules/nixos/window-manager.nix + disko.nixosModules.disko + inputs.stylix.nixosModules.stylix inputs.home-manager.nixosModules.default + ./hosts/work/configuration.nix + ./hosts/work/hardware-configuration.nix ]; }; }; homeConfigurations = { - "xmorel@work" = inputs.home-manager.lib.homeManagerConfiguration { + "xmorel@work-laptop" = inputs.home-manager.lib.homeManagerConfiguration { pkgs = pkgs; extraSpecialArgs = {inherit inputs;}; modules = [ diff --git a/hosts/home/configuration.nix b/hosts/home/configuration.nix index 60ffe77..6f2a597 100644 --- a/hosts/home/configuration.nix +++ b/hosts/home/configuration.nix @@ -71,7 +71,21 @@ pulseaudio.enable = false; graphics.enable = true; }; - security.rtkit.enable = true; + + environment.sessionVariables = { + FLAKE = "/home/yoru/nixos"; + }; + + security = { + rtkit.enable = true; + sudo.extraRules = [{ + users = [ "yoru" ]; + commands = [{ + command = "ALL"; + options = [ "NOPASSWD" ]; + }]; + }]; + }; services = { xserver.enable = true; diff --git a/hosts/work/configuration.nix b/hosts/work/configuration.nix new file mode 100644 index 0000000..355159c --- /dev/null +++ b/hosts/work/configuration.nix @@ -0,0 +1,135 @@ +{ + inputs, + modulesPath, + lib, + pkgs, + ... +}: +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ./disk-config.nix + ]; + boot.loader.grub = { + efiSupport = true; + efiInstallAsRemovable = true; + }; + services.openssh.enable = true; + environment.sessionVariables = { + FLAKE = "/etc/nixos"; + }; + environment.systemPackages = map lib.lowPrio [ + pkgs.curl + pkgs.gitMinimal + pkgs.slack + pkgs.teams-for-linux + pkgs.openvpn + ]; + networking = { + hostName = "work-laptop"; + networkmanager.enable = true; + }; + time.timeZone = "Europe/Paris"; + i18n.defaultLocale = "fr_FR.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "fr_FR.UTF-8"; + LC_IDENTIFICATION = "fr_FR.UTF-8"; + LC_MEASUREMENT = "fr_FR.UTF-8"; + LC_MONETARY = "fr_FR.UTF-8"; + LC_NAME = "fr_FR.UTF-8"; + LC_NUMERIC = "fr_FR.UTF-8"; + LC_PAPER = "fr_FR.UTF-8"; + LC_TELEPHONE = "fr_FR.UTF-8"; + LC_TIME = "fr_FR.UTF-8"; + }; + + virtualisation.docker = { + enable = true; + }; + + security.rtkit.enable = true; + nix = { + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + }; + # gc = { + # automatic = true; + # dates = "weekly"; + # option = "--delete-older-than 10d"; + # }; + }; + services = { + xserver.enable = true; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + cli-environment.enable = true; + # desktop-apps.enable = true; + dev-environment.enable = true; + fonts.enable = true; + window-manager.enable = true; + }; + users.users = { + xmorel = { + shell = pkgs.fish; + isNormalUser = true; + extraGroups = [ "networkmanager" "wheel" "docker" ]; + initialPassword = "toto"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBd3US4tUcbWZQgcVOtZIcbHF5mHwzJzygrQuE/pGde6" + ]; + }; + root = { + initialPassword = "toto"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBd3US4tUcbWZQgcVOtZIcbHF5mHwzJzygrQuE/pGde6" + ]; + }; + }; + home-manager = { + extraSpecialArgs = {inherit inputs;}; + users = { + "xmorel" = import ./home.nix; + }; + }; + + stylix = { + enable = true; + image = ../../wall.jpg; + polarity = "dark"; + opacity.terminal = 0.9; + cursor.package = pkgs.bibata-cursors; + cursor.name = "Bibata-Modern-Ice"; + cursor.size = 24; + fonts = { + monospace = { + package = pkgs.nerd-fonts.jetbrains-mono; + name = "JetBrainsMono Nerd Font Mono"; + }; + sansSerif = { + package = pkgs.montserrat; + name = "Montserrat"; + }; + serif = { + package = pkgs.montserrat; + name = "Montserrat"; + }; + sizes = { + applications = 12; + terminal = 12; + desktop = 11; + popups = 12; + }; + }; + }; + + + + nixpkgs.config.allowUnfree = true; + system.stateVersion = "24.05"; +} diff --git a/hosts/work/disk-config.nix b/hosts/work/disk-config.nix new file mode 100644 index 0000000..a70a7fb --- /dev/null +++ b/hosts/work/disk-config.nix @@ -0,0 +1,56 @@ +{ lib, ...}: +{ + disko.devices = { + disk.main = { + device = lib.mkDefault "/dev/nvme0n1"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["umask=0077"]; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + }; + }; + }; + }; + lvm_vg = { + pool = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%FREE"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ + "defaults" + ]; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/work/hardware-configuration.nix b/hosts/work/hardware-configuration.nix new file mode 100644 index 0000000..102fb0f --- /dev/null +++ b/hosts/work/hardware-configuration.nix @@ -0,0 +1,26 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0f0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0f3u1u3c2.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/work/home.nix b/hosts/work/home.nix index 3fa95b6..5ad7011 100644 --- a/hosts/work/home.nix +++ b/hosts/work/home.nix @@ -12,15 +12,75 @@ ../../modules/home-manager/kitty.nix ]; - # myHome.dotfiles.enable = true; + myHome.dotfiles.enable = true; myHome.helix.enable = true; - # myHome.waybar.enable = true; + myHome.waybar.enable = true; myHome.kitty.enable = true; myHome.shell.enable = true; - # TODO Move somewhere... - # programs.spotify-player.enable = true; + gtk = { + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + }; + gtk3.extraConfig = { + gtk-application-prefer-dark-theme = 1; + }; + gtk4.extraConfig = { + gtk-application-prefer-dark-theme = 1; + }; + }; + qt = { + enable = true; + style.name = "adwaita-dark"; + platformTheme.name = "gtk3"; + }; + services = { + hypridle = { + enable = true; + settings = { + general = { + after_sleep_cmd = "hyprctl dispatch dpms on"; + ignore_dbus_inhibit = false; + lock_cmd = "hyprlock"; + }; + listener = [ + { + timeout = 900; + on-timeout = "hyprlock"; + } + { + timeout = 1200; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + ]; + }; + }; + }; + + programs = { + firefox.enable = true; + gh.enable = true; + btop = { + enable = true; + settings = { + vim_keys = true; + }; + }; + home-manager.enable = true; + hyprlock = { + enable = true; + settings = { + general = { + disable_loading_bar = true; + grace = 10; + hide_cursor = true; + no_fade_in = false; + }; + }; + }; + }; - programs.home-manager.enable = true; home.stateVersion = "23.11"; } diff --git a/modules/nixos/dev-environment.nix b/modules/nixos/dev-environment.nix index 544e6e3..c830b52 100644 --- a/modules/nixos/dev-environment.nix +++ b/modules/nixos/dev-environment.nix @@ -12,11 +12,14 @@ in config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ - docker - docker-compose + # docker + # docker-compose git - cargo - rustup + gh + jujutsu + jjui + # cargo + # rustup ]; }; }