From 61335826af45a16d3b950d970c020f53d2e9dc73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Krop=C3=A1=C4=8Dek?= Date: Sun, 22 Sep 2024 21:36:02 +0200 Subject: [PATCH] added lenar --- flake.nix | 13 ++++ hosts/lenar/default.nix | 32 +++++++++ hosts/lenar/disko.nix | 53 +++++++++++++++ hosts/lenar/home.nix | 147 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 245 insertions(+) create mode 100644 hosts/lenar/default.nix create mode 100644 hosts/lenar/disko.nix create mode 100644 hosts/lenar/home.nix diff --git a/flake.nix b/flake.nix index f45ff9c..f9b403d 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,8 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + + disko.url = "github:nix-community/disko"; }; outputs = @@ -28,6 +30,17 @@ inherit inputs; }; }; + lenar = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/lenar + ./hosts/base + inputs.disko.nixosModules.disko + ]; + specialArgs = { + inherit inputs; + }; + }; }; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; }; diff --git a/hosts/lenar/default.nix b/hosts/lenar/default.nix new file mode 100644 index 0000000..5815b2a --- /dev/null +++ b/hosts/lenar/default.nix @@ -0,0 +1,32 @@ +{ + config, + pkgs, + inputs, + ... +}: +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + networking.hostName = "lenar"; # Define your hostname. + + # My own modules configuration + krop = { + ide = { + enable = true; + install-pycharm = true; + }; + python.install-older = true; + }; + + home-manager = { + extraSpecialArgs = { + inherit inputs; + }; + users = { + "krop" = import ./home.nix; + }; + }; +} diff --git a/hosts/lenar/disko.nix b/hosts/lenar/disko.nix new file mode 100644 index 0000000..8a35c81 --- /dev/null +++ b/hosts/lenar/disko.nix @@ -0,0 +1,53 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "128M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + # Subvolume name is different from mountpoint + "/rootfs" = { + mountpoint = "/"; + }; + # Subvolume name is the same as the mountpoint + "/home" = { + mountOptions = [ "compress=zstd" ]; + mountpoint = "/home"; + }; + # Parent is not mounted so the mountpoint must be set + "/nix" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/nix"; + }; + }; + mountpoint = "/partition-root"; + }; + }; + }; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/hosts/lenar/home.nix b/hosts/lenar/home.nix new file mode 100644 index 0000000..31dcc03 --- /dev/null +++ b/hosts/lenar/home.nix @@ -0,0 +1,147 @@ +{ config, pkgs, ... }: + +{ + home.username = "krop"; + home.homeDirectory = "/home/krop"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "24.05"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + gnomeExtensions.grand-theft-focus + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/krop/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + dconf = { + enable = true; + settings."org/gnome/shell" = { + disable-user-extensions = false; + enabled-extensions = with pkgs.gnomeExtensions; [ + grand-theft-focus.extensionUuid + ]; + }; + }; + + gtk = { + enable = true; + gtk3.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + gtk4.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + }; + + qt = { + enable = true; + platformTheme.name = "adwaita"; # TODO: fix themes + style.name = "adwaita-dark"; + }; + + programs.git = { + enable = true; + userName = "Jakub Kropáček"; + userEmail = "kropikuba@gmail.com"; + includes = + let + workcfg = { + user = { + email = "jakub.kropacek@olc.cz"; + name = "Jakub Kropáček"; + }; + }; + in + [ + { + condition = "gitdir:~/Repositories/OLC/**"; + contents = workcfg; + } + { + condition = "gitdir:~/Repositories/OLC-Hexpol/**"; + contents = workcfg; + } + ]; + extraConfig = { + init = { + defaultBranch = "master"; + }; + push = { + autoSetupRemote = true; + }; + status = { + submoduleSummary = true; + }; + diff = { + submodule = "log"; + }; + core = { + autocrlf = "input"; + }; + }; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +}