diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9331854 --- /dev/null +++ b/flake.nix @@ -0,0 +1,12 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + outputs = { self, nixpkgs, ... }@attrs: { + nixosConfigurations = { + nixos = import ./nixos attrs; + }; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 0000000..3bb4857 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: + +{ + # Basic system settings + networking.hostName = "localhost"; + time.timeZone = "Europe/London"; + + # User configuration + users.users.compey = { + isNormalUser = true; + home = "/home/compey"; + extraGroups = [ "wheel" ]; + password = "$6$qVioWfelj.mvmSeM$x.scXIyRhimd.Kp2.Yzzqq8gGctYsT1Tfz4Gf14pb3Kgtbjh59PIF62uahzgUP.SdzUkLPm/arMSilpcdsC561"; + shell = pkgs.fish; + }; + + # Create root user + users.users.root.initialHashedPassword = ""; + + # Enable sudo support + security.sudo.enable = true; + security.sudo.wheelNeedsPassword = false; + + # Enable OpenSSH server (optional) + services.openssh.enable = true; + services.openssh.permitRootLogin = "prohibit-password"; +} + diff --git a/nixos/default.nix b/nixos/default.nix new file mode 100644 index 0000000..85c8739 --- /dev/null +++ b/nixos/default.nix @@ -0,0 +1,16 @@ +{ nixpkgs, ... }@inputs: + +nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + + modules = [ + ./nix.nix + ./configuration.nix + ./programs/xdg.nix + ./programs/neovim.nix + ./programs/shell.nix + ]; +} diff --git a/nixos/nix.nix b/nixos/nix.nix new file mode 100644 index 0000000..0f4a4fe --- /dev/null +++ b/nixos/nix.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + nix.settings.experimental-features = [ "nix-command" "flakes" ]; +} diff --git a/nixos/programs/neovim.nix b/nixos/programs/neovim.nix new file mode 100644 index 0000000..c3bf501 --- /dev/null +++ b/nixos/programs/neovim.nix @@ -0,0 +1,12 @@ +{ config, ... }: + +{ + xdg.configFile."nvim" = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/.config/nvim"; + }; + + programs.neovim = { + enable = true; + defaultEditor = true; + }; +} diff --git a/nixos/programs/shell.nix b/nixos/programs/shell.nix new file mode 100644 index 0000000..6fc8c7e --- /dev/null +++ b/nixos/programs/shell.nix @@ -0,0 +1,42 @@ +{ pkgs, ... }: + +{ + programs.bash.enable = true; + programs.fish = { + enable = true; + plugins = [ + { + name = "fisher"; + src = pkgs.fetchFromGitHub { + owner = "jorgebucaran"; + repo = "fisher"; + rev = "4.4.5"; + sha256 = "0y87w6gdr56808fjc3xpidqrc27cj7cr0kp9d5ca6v3y05a3bgdd"; + }; + } + ]; + }; + + home.file.".bashrc".source = lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/.bashrc" + home.file.".bash_profile".source = lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/.bash_profile" + home.file.".profile".source = lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/.profile" + xdg.configFile."fish" = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/.config/fish"; + }; + + home.packages = [ + pkgs.lsd + pkgs.bat + pkgs.zoxide + (pkgs.stdenv.mkDerivation { + pname = "catppuccin-fish"; + version = "1.0.0"; + buildInputs = [ pkgs.fish ]; + installPhase = '' + fisher install catppuccin/fish + fish_config theme save "Catppuccin Mocha" + ''; + }) + ]; +} + diff --git a/nixos/programs/xdg.nix b/nixos/programs/xdg.nix new file mode 100644 index 0000000..91fe4fb --- /dev/null +++ b/nixos/programs/xdg.nix @@ -0,0 +1,11 @@ +{ config, ... }: + +{ + xdg = { + enable = true; + userDirs = { + enable = true; + createDirectories = true; + }; + }; +}