NixOnDroid : Create HM env.

This commit is contained in:
Dmitry Voronin 2024-03-04 23:11:23 +03:00
parent 55fc9346a3
commit de4e0b0e65
6 changed files with 29 additions and 49 deletions

View file

@ -36,28 +36,6 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nix-on-droid",
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1663932797,
"narHash": "sha256-IH8ZBW99W2k7wKLS+Sat9HiKX1TPZjFTnsPizK5crok=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "de3758e31a3a1bc79d569f5deb5dac39791bf9b6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-formatter-pack": { "nix-formatter-pack": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -83,7 +61,9 @@
}, },
"nix-on-droid": { "nix-on-droid": {
"inputs": { "inputs": {
"home-manager": "home-manager_2", "home-manager": [
"home-manager"
],
"nix-formatter-pack": "nix-formatter-pack", "nix-formatter-pack": "nix-formatter-pack",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -533,21 +513,6 @@
"nvimTrouble": "nvimTrouble", "nvimTrouble": "nvimTrouble",
"nvimWhichKey": "nvimWhichKey" "nvimWhichKey": "nvimWhichKey"
} }
},
"utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -14,7 +14,8 @@
# Android. # Android.
nix-on-droid = { nix-on-droid = {
url = "github:t184256/nix-on-droid/release-23.05"; url = "github:t184256/nix-on-droid/release-23.05";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
}; };
# Nvim plugins. # Nvim plugins.
@ -103,8 +104,9 @@
outputs = { self, nixpkgs, dotfiles, nix-on-droid, home-manager, ... } @inputs: { outputs = { self, nixpkgs, dotfiles, nix-on-droid, home-manager, ... } @inputs: {
# Constant values. # Constant values.
nixosModules.const = { nixosModules.const = {
hashedPassword = "$y$j9T$oqCB16i5E2t1t/HAWaFd5.$tTaHtAcifXaDVpTcRv.yH2/eWKxKE9xM8KcqXHfHrD7"; # Use `mkpasswd`. hashedPassword = "$y$j9T$oqCB16i5E2t1t/HAWaFd5.$tTaHtAcifXaDVpTcRv.yH2/eWKxKE9xM8KcqXHfHrD7"; # Use `mkpasswd`.
stateVersion = "23.11"; stateVersion = "23.11";
droidStateVersion = "22.11";
}; };
# Common modules used across all hosts. # Common modules used across all hosts.
@ -144,7 +146,7 @@
modules = [ modules = [
./host/${hostname}/Configuration.nix ./host/${hostname}/Configuration.nix
{ networking.hostName = hostname; } { networking.hostName = hostname; }
{ system.stateVersion = inputs.self.nixosModules.const.stateVersion; } { system.stateVersion = self.nixosModules.const.stateVersion; }
inputs.self.nixosModules.common inputs.self.nixosModules.common
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
] ++ modules; ] ++ modules;
@ -258,6 +260,9 @@
{ system.stateVersion = inputs.self.nixosModules.const.stateVersion; } { system.stateVersion = inputs.self.nixosModules.const.stateVersion; }
./module/NixOnDroid.nix ./module/NixOnDroid.nix
]; ];
extraSpecialArgs.const = self.nixosModules.const;
extraSpecialArgs.flake = self;
extraSpecialArgs.inputs = inputs;
}; };
}; };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { { pkgs, inputs, const, ... }: {
environment.packages = with pkgs; [ environment.packages = with pkgs; [
android-tools android-tools
binwalk binwalk
@ -37,4 +37,14 @@
yt-dlp yt-dlp
zip unzip zip unzip
]; ];
home-manager.config = {
home.stateVersion = const.droidStateVersion;
home.file = {
"nixos".source = inputs.dotfiles;
};
programs.bash = {
bashrcExtra = "source ~/nixos/module/common/bash/Bashrc.sh";
};
};
} }

View file

@ -1,3 +1,3 @@
{ specialArgs, ... }: { { const, ... }: {
users.users.root.hashedPassword = specialArgs.const.hashedPassword; users.users.root.hashedPassword = const.hashedPassword;
} }

View file

@ -1,9 +1,9 @@
{ pkgs, lib, specialArgs, ... }: { { pkgs, lib, const, ... }: {
imports = [ imports = [
./home/Voronind.nix ./home/Voronind.nix
]; ];
users.users.voronind = { users.users.voronind = {
hashedPassword = specialArgs.const.hashedPassword; hashedPassword = const.hashedPassword;
uid = 1000; uid = 1000;
createHome = true; createHome = true;
isNormalUser = true; isNormalUser = true;

View file

@ -1,4 +1,4 @@
{ inputs, ... }: let { const, ... }: let
username = "voronind"; username = "voronind";
homeDir = "/home/voronind"; homeDir = "/home/voronind";
in { in {
@ -6,7 +6,7 @@ in {
programs.home-manager.enable = true; programs.home-manager.enable = true;
home.username = username; home.username = username;
home.homeDirectory = homeDir; home.homeDirectory = homeDir;
home.stateVersion = inputs.self.nixosModules.const.stateVersion; home.stateVersion = const.stateVersion;
home.file = { home.file = {
".config/btop".source = ./module/top/btop; ".config/btop".source = ./module/top/btop;