From c44a6843f85ff4120a0335698fd10c899188b6a2 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 20 Aug 2023 00:48:31 +0200 Subject: [PATCH] Begin restructure --- REAME.md | 4 +- configuration.nix | 105 ------------------ flake.nix | 30 +++-- home.nix | 35 ------ home/index.nix | 14 +++ .../nixos-test/hardware-configuration.nix | 0 hosts/nixos-test/index.nix | 44 ++++++++ modules/system.nix | 51 +++++++++ 8 files changed, 132 insertions(+), 151 deletions(-) delete mode 100644 configuration.nix delete mode 100644 home.nix create mode 100644 home/index.nix rename hardware-configuration.nix => hosts/nixos-test/hardware-configuration.nix (100%) create mode 100644 hosts/nixos-test/index.nix create mode 100644 modules/system.nix diff --git a/REAME.md b/REAME.md index 6718d96..c11f1c9 100644 --- a/REAME.md +++ b/REAME.md @@ -2,4 +2,6 @@ ```bash nixos-rebuild switch --flake flake_path_directory#hostname -``` \ No newline at end of file +``` + +https://github.com/ryan4yin/nix-config/tree/v0.0.2 \ No newline at end of file diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index b41bca7..0000000 --- a/configuration.nix +++ /dev/null @@ -1,105 +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, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - # Bootloader. - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/vda"; - boot.loader.grub.useOSProber = true; - - networking.hostName = "nixos"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/Paris"; - - # Select internationalisation properties. - 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"; - }; - - # Configure keymap in X11 - services.xserver = { - layout = "us"; - xkbVariant = "altgr-intl"; - }; - - # Configure console keymap - console.keyMap = "us"; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.florian = { - isNormalUser = true; - description = "Florian RICHER"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; []; - }; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - git - # wget - ]; - - environment.variables.EDITOR = "vim"; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? - -} diff --git a/flake.nix b/flake.nix index 9f6c84d..d56131b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,27 +1,37 @@ { - description = "MrDev023's NixOS Flake"; + description = "NixOS configuration of MrDev023"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - home-manager = { - url = "github:nix-community/home-manager/release-23.05"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + nixConfig = { + experimental-features = [ "nix-command" "flakes" ]; }; - outputs = inputs@{ nixpkgs, home-manager, ... }: { + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ + self, + nixpkgs, + home-manager, + nix-vscode-extensions, + ... + }: { nixosConfigurations = { nixos-test = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; + modules = [ - ./configuration.nix + ./hosts/nixos-test home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.florian = import ./home.nix; + home-manager.extraSpecialArgs = inputs; + home-manager.users.florian = import ./home; } ]; }; diff --git a/home.nix b/home.nix deleted file mode 100644 index 943a5dd..0000000 --- a/home.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ config, pkgs, ... }: - -{ - home.username = "florian"; - home.homeDirectory = "/home/florian"; - - # link the configuration file in current directory to the specified location in home directory - # home.file.".config/i3/wallpaper.jpg".source = ./wallpaper.jpg; - - # link all files in `./scripts` to `~/.config/i3/scripts` - # home.file.".config/i3/scripts" = { - # source = ./scripts; - # recursive = true; # link recursively - # executable = true; # make all files executable - # }; - - # encode the file content in nix configuration file directly - # home.file.".xxx".text = '' - # xxx - # ''; - - programs.git = { - enable = true; - userName = "Florian RICHER"; - userEmail = "florian.richer@protonmail.com"; - }; - - home.packages = with pkgs; [ - vim - ]; - - home.stateVersion = "23.05"; - - programs.home-manager.enable = true; -} \ No newline at end of file diff --git a/home/index.nix b/home/index.nix new file mode 100644 index 0000000..7356d01 --- /dev/null +++ b/home/index.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +{ + imports = []; + + home = { + username = "florian"; + homeDirectory = "/home/florian"; + + stateVersion = "23.05"; + }; + + programs.home-manager.enable = true; +} \ No newline at end of file diff --git a/hardware-configuration.nix b/hosts/nixos-test/hardware-configuration.nix similarity index 100% rename from hardware-configuration.nix rename to hosts/nixos-test/hardware-configuration.nix diff --git a/hosts/nixos-test/index.nix b/hosts/nixos-test/index.nix new file mode 100644 index 0000000..47f77cb --- /dev/null +++ b/hosts/nixos-test/index.nix @@ -0,0 +1,44 @@ +# 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, ... }: + +{ + imports = + [ + ../../modules/system.nix + + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader = { + grub = { + enable = true; + device = "/dev/vda"; + efiSupport = false; + useOSProber = true; + }; + }; + + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.05"; + +} diff --git a/modules/system.nix b/modules/system.nix new file mode 100644 index 0000000..f552ee8 --- /dev/null +++ b/modules/system.nix @@ -0,0 +1,51 @@ +{ config, pkgs, ... }: + +{ + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # Select internationalisation properties. + 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"; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = "altgr-intl"; + }; + + # Configure console keymap + console.keyMap = "us"; + + networking.firewall.enable = false; + + nixpkgs.config.allowUnfree = true; + + environment.systemPackages = with pkgs; [ + vim + git + ]; + + programs.git = { + enable = true; + userName = "Florian RICHER"; + userEmail = "florian.richer@protonmail.com"; + }; + + users.users.florian = { + isNormalUser = true; + description = "florian"; + extraGroups = [ "networkmanager" "wheel" ]; + }; +} \ No newline at end of file