diff --git a/flake.lock b/flake.lock index 4469374..9bf739c 100755 --- a/flake.lock +++ b/flake.lock @@ -254,6 +254,32 @@ "type": "github" } }, + "nix-formatter-pack": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "nmd": [ + "nmd" + ], + "nmt": [ + "nmt" + ] + }, + "locked": { + "lastModified": 1709879831, + "narHash": "sha256-PZFXvKm929A3waipt2prRKYlNJvGQiBxWPDn/MIOKWo=", + "owner": "Gerschtli", + "repo": "nix-formatter-pack", + "rev": "2499f41a01f1154c5a3b967aabe37d94e6b6d18b", + "type": "github" + }, + "original": { + "owner": "Gerschtli", + "repo": "nix-formatter-pack", + "type": "github" + } + }, "nix-gaming": { "inputs": { "flake-parts": [ @@ -277,6 +303,40 @@ "type": "github" } }, + "nix-on-droid": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nix-formatter-pack": [ + "nix-formatter-pack" + ], + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-docs": [ + "nixpkgs" + ], + "nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap", + "nmd": [ + "nmd" + ] + }, + "locked": { + "lastModified": 1709879753, + "narHash": "sha256-zEpy3eweBus/cW/oRMBINps6Bnlazpa7TadonwWibHA=", + "owner": "nix-community", + "repo": "nix-on-droid", + "rev": "7b3cc6e3f9919b2d23003cfafb60c146c3f45793", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "nix-on-droid", + "type": "github" + } + }, "nixcasks": { "inputs": { "nixpkgs": [ @@ -328,6 +388,22 @@ "type": "github" } }, + "nixpkgs-for-bootstrap": { + "locked": { + "lastModified": 1708105575, + "narHash": "sha256-sS4AItZeUnAei6v8FqxNlm+/27MPlfoGym/TZP0rmH0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1d1817869c47682a6bee85b5b0a6537b6c0fba26", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1d1817869c47682a6bee85b5b0a6537b6c0fba26", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1709569716, @@ -344,6 +420,45 @@ "type": "github" } }, + "nmd": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "scss-reset": [ + "scss-reset" + ] + }, + "locked": { + "lastModified": 1705050560, + "narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=", + "owner": "~rycee", + "repo": "nmd", + "rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3", + "type": "sourcehut" + }, + "original": { + "owner": "~rycee", + "repo": "nmd", + "type": "sourcehut" + } + }, + "nmt": { + "flake": false, + "locked": { + "lastModified": 1705307515, + "narHash": "sha256-krVKx3/u1mDo8qe5qylYgmwAmlAPHa1BSPDzxq09FmI=", + "owner": "~rycee", + "repo": "nmt", + "rev": "1562940b7765a32f1987bd9a3ee6a4fa034c9429", + "type": "sourcehut" + }, + "original": { + "owner": "~rycee", + "repo": "nmt", + "type": "sourcehut" + } + }, "nur": { "locked": { "lastModified": 1709714153, @@ -431,15 +546,20 @@ "lanzaboote": "lanzaboote", "neovim": "neovim", "nix-darwin": "nix-darwin", + "nix-formatter-pack": "nix-formatter-pack", "nix-gaming": "nix-gaming", + "nix-on-droid": "nix-on-droid", "nixcasks": "nixcasks", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable", + "nmd": "nmd", + "nmt": "nmt", "nur": "nur", "nvfetcher": "nvfetcher", "pre-commit-hooks-nix": "pre-commit-hooks-nix", "rust-overlay": "rust-overlay", + "scss-reset": "scss-reset", "sops-nix": "sops-nix", "spicetify-nix": "spicetify-nix", "systems": "systems", @@ -469,6 +589,22 @@ "type": "github" } }, + "scss-reset": { + "flake": false, + "locked": { + "lastModified": 1683906868, + "narHash": "sha256-cif5Sx8Ca5vxdw/mNAgpulLH15TwmzyJFNM7JURpoaE=", + "owner": "andreymatin", + "repo": "scss-reset", + "rev": "5a7bd491ac82441e6283fb0d5d54644b913b30c7", + "type": "github" + }, + "original": { + "owner": "andreymatin", + "repo": "scss-reset", + "type": "github" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 9e892d0..b6eee23 100755 --- a/flake.nix +++ b/flake.nix @@ -57,6 +57,14 @@ nixos-hardware = { url = "github:NixOS/nixos-hardware"; }; + nix-on-droid = { + url = "github:nix-community/nix-on-droid/release-23.11"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs-docs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + inputs.nix-formatter-pack.follows = "nix-formatter-pack"; + inputs.nmd.follows = "nmd"; + }; nixcasks = { # contains unfree url = "github:jacekszymanski/nixcasks"; @@ -97,6 +105,21 @@ url = "github:hercules-ci/gitignore.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-formatter-pack = { + url = "github:Gerschtli/nix-formatter-pack"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nmd.follows = "nmd"; + inputs.nmt.follows = "nmt"; + }; + nmd = { + url = "sourcehut:~rycee/nmd"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.scss-reset.follows = "scss-reset"; + }; + nmt = { + url = "sourcehut:~rycee/nmt"; + flake = false; + }; nvfetcher = { url = "github:berberman/nvfetcher"; inputs.nixpkgs.follows = "nixpkgs"; @@ -116,6 +139,10 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; + scss-reset = { + url = "github:andreymatin/scss-reset"; + flake = false; + }; }; outputs = inputs: @@ -144,6 +171,12 @@ inherit system modules; specialArgs = {inherit inputs;}; }; + + mkDroid = modules: + inputs.nix-on-droid.lib.nixOnDroidConfiguration { + inherit modules; + extraSpecialArgs = {inherit inputs;}; + }; in { ### imports = []; nixosModules.default = ./nixos/modules; @@ -164,5 +197,9 @@ "plato" = mkDarwin "x86_64-darwin" [./hosts/plato]; "whitesteel" = mkDarwin "x86_64-darwin" [./hosts/whitesteel]; }; + + nixOnDroidConfigurations = { + "socrates" = mkDroid [./hosts/socrates]; + }; }); } diff --git a/home/applications/git/default.nix b/home/applications/git/default.nix index d416b59..902f975 100644 --- a/home/applications/git/default.nix +++ b/home/applications/git/default.nix @@ -1,5 +1,4 @@ { - programs.gh.enable = true; programs.git = { enable = true; userName = "Guanran Wang"; @@ -13,9 +12,5 @@ }; }; - xdg.configFile."gh/hosts.yml".text = '' - github.com: - git_protocol: https - user: Guanran928 - ''; + programs.gh.enable = true; } diff --git a/home/default.nix b/home/default.nix index a024a7f..12f118e 100644 --- a/home/default.nix +++ b/home/default.nix @@ -2,14 +2,19 @@ inputs, pkgs, config, + lib, ... }: { home = { - username = "guanranwang"; + # for nix-on-droid + username = lib.mkDefault "guanranwang"; homeDirectory = - if pkgs.stdenv.hostPlatform.isDarwin - then "/Users/${config.home.username}" - else "/home/${config.home.username}"; + lib.mkDefault + ( + if pkgs.stdenv.hostPlatform.isDarwin + then "/Users/${config.home.username}" + else "/home/${config.home.username}" + ); # This value determines the Home Manager release that your # configuration is compatible with. This helps avoid breakage diff --git a/hosts/socrates/default.nix b/hosts/socrates/default.nix new file mode 100644 index 0000000..e90cb40 --- /dev/null +++ b/hosts/socrates/default.nix @@ -0,0 +1,71 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: { + environment.packages = with pkgs; [ + git + openssh + + diffutils + findutils + utillinux + tzdata + hostname + man + gnugrep + gnupg + gnused + gnutar + bzip2 + gzip + xz + zip + unzip + ]; + + # Backup etc files instead of failing to activate generation if a file already exists in /etc + environment.etcBackupExtension = ".bak"; + + # Read the changelog before changing this value + system.stateVersion = "24.05"; + + # Set up nix for flakes + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + # Set your time zone + time.timeZone = "Asia/Shanghai"; + + # Set termux font + # NOTE: Use "Mono" variation, or Termux will cut your icons in half + terminal.font = "${pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];}}/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFontMono-Regular.ttf"; + + # Set user shell + user.shell = lib.getExe pkgs.fish; + environment.sessionVariables."SHELL" = lib.getExe pkgs.fish; + + # Set up HM + home-manager = { + backupFileExtension = "hmbak"; + useGlobalPkgs = true; + extraSpecialArgs = { + inherit inputs; + osConfig = config; + }; + config = ../../home; + sharedModules = [ + ({...}: { + imports = [ + ../../home/applications/bash + ../../home/applications/fish + ../../home/applications/neovim + ../../home/applications/nix + ]; + }) + ]; + }; +}