1

feat: add nix on droid for my android phone

docs: documentation for nix-on-droid

feat: bump flake

chore: bump flake
This commit is contained in:
Himadri Bhattacharjee
2024-05-12 06:46:08 +05:30
parent 7973a929dc
commit 0b0e8b5470
5 changed files with 306 additions and 20 deletions

View File

@@ -9,8 +9,7 @@ and clone this repository.
```sh ```sh
git clone https://github.com/lavafroth/dotfiles git clone https://github.com/lavafroth/dotfiles
cd dotfiles sudo nixos-rebuild switch --flake dotfiles#cafe-nosecureboot
sudo nixos-rebuild switch --flake .#cafe-nosecureboot
``` ```
#### Secureboot #### Secureboot
@@ -23,7 +22,7 @@ clear the manufacturer keys and enroll yours as described [here](https://github.
Once the keys are enrolled, run the following to rebuild the system from now on Once the keys are enrolled, run the following to rebuild the system from now on
```sh ```sh
sudo nixos-rebuild switch --flake . sudo nixos-rebuild switch --flake dotfiles
``` ```
#### Sponsorblock for mpv #### Sponsorblock for mpv
@@ -31,8 +30,8 @@ sudo nixos-rebuild switch --flake .
Optionally, if you want to block sponsors in mpv, run Optionally, if you want to block sponsors in mpv, run
```sh ```sh
pushd sources/mpv-sponsorblock pushd dotfiles/hosts/default/sources/mpv-sponsorblock
mkdir sources/mpv/scripts mkdir dotfiles/hosts/default/sources/mpv/scripts
nix build nix build
cp result/lib/libmpv_sponsorblock.so ../mpv/scripts/sponsorblock.so cp result/lib/libmpv_sponsorblock.so ../mpv/scripts/sponsorblock.so
popd popd
@@ -47,8 +46,18 @@ Clone this repo, enter the directory and run a rebuild for the host `rahu`.
```sh ```sh
git clone https://github.com/lavafroth/dotfiles git clone https://github.com/lavafroth/dotfiles
cd dotfiles sudo nixos-rebuild switch --flake dotfiles#rahu
sudo nixos-rebuild switch --flake .#rahu ```
### Android (Nix-on-droid)
I use Nix-on-droid to have Termux with a declarative config. Install
[Nix-on-droid from F-Droid](https://f-droid.org/en/packages/com.termux.nix/) and
enable flakes when prompted. Clone this repo and rebuild the environment.
```sh
git clone https://github.com/lavafroth/dotfiles
nix-on-droid switch --flake dotfiles
``` ```
## Troubleshooting ## Troubleshooting

235
flake.lock generated
View File

@@ -49,6 +49,22 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1688025799,
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@@ -117,11 +133,32 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1715077503, "lastModified": 1716457508,
"narHash": "sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0=", "narHash": "sha256-ZxzffLuWRyuMrkVVq7wastNUqeO0HJL9xqfY1QsYaqo=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "6e277d9566de9976f47228dd8c580b97488734d4", "rev": "850cb322046ef1a268449cf1ceda5fd24d930b05",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nix-on-droid",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709445365,
"narHash": "sha256-DVv6nd9FQBbMWbOmhq0KVqmlc3y3FMSYl49UXmMcO+0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "4de84265d7ec7634a69ba75028696d74de9a44a7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -157,13 +194,83 @@
"type": "github" "type": "github"
} }
}, },
"nix-formatter-pack": {
"inputs": {
"nixpkgs": [
"nix-on-droid",
"nixpkgs"
],
"nmd": "nmd",
"nmt": "nmt"
},
"locked": {
"lastModified": 1705252799,
"narHash": "sha256-HgSTREh7VoXjGgNDwKQUYcYo13rPkltW7IitHrTPA5c=",
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"rev": "2de39dedd79aab14c01b9e2934842051a160ffa5",
"type": "github"
},
"original": {
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"type": "github"
}
},
"nix-on-droid": {
"inputs": {
"home-manager": "home-manager_2",
"nix-formatter-pack": "nix-formatter-pack",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-docs": "nixpkgs-docs",
"nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap",
"nmd": "nmd_2"
},
"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"
}
},
"nixos-cosmic": {
"inputs": {
"flake-compat": "flake-compat_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1716493982,
"narHash": "sha256-KSdPjenUqX8wt8hV+1p1O5vkkVo6Ae1+seG6HLsEhos=",
"owner": "lilyinstarlight",
"repo": "nixos-cosmic",
"rev": "89d75599135c90ab3c0270fa272bf85860bf847c",
"type": "github"
},
"original": {
"owner": "lilyinstarlight",
"repo": "nixos-cosmic",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1714906307, "lastModified": 1716330097,
"narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=", "narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "25865a40d14b3f9cf19f19b924e2ab4069b09588", "rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -173,6 +280,38 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-docs": {
"locked": {
"lastModified": 1705957679,
"narHash": "sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9a333eaa80901efe01df07eade2c16d183761fa3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.05",
"repo": "nixpkgs",
"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": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1678872516, "lastModified": 1678872516,
@@ -191,11 +330,11 @@
}, },
"nixpkgs-stable_2": { "nixpkgs-stable_2": {
"locked": { "locked": {
"lastModified": 1714858427, "lastModified": 1716061101,
"narHash": "sha256-tCxeDP4C1pWe2rYY3IIhdA40Ujz32Ufd4tcrHPSKx2M=", "narHash": "sha256-H0eCta7ahEgloGIwE/ihkyGstOGu+kQwAiHvwVoXaA0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b980b91038fc4b09067ef97bbe5ad07eecca1e76", "rev": "e7cc61784ddf51c81487637b3031a6dd2d6673a2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -205,6 +344,60 @@
"type": "github" "type": "github"
} }
}, },
"nmd": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmd_2": {
"inputs": {
"nixpkgs": [
"nix-on-droid",
"nixpkgs-docs"
],
"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": 1648075362,
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
"owner": "rycee",
"repo": "nmt",
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmt",
"type": "gitlab"
}
},
"pre-commit-hooks-nix": { "pre-commit-hooks-nix": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@@ -240,6 +433,8 @@
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"nix-on-droid": "nix-on-droid",
"nixos-cosmic": "nixos-cosmic",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
} }
@@ -269,6 +464,22 @@
"type": "github" "type": "github"
} }
}, },
"scss-reset": {
"flake": false,
"locked": {
"lastModified": 1631450058,
"narHash": "sha256-muDlZJPtXDIGevSEWkicPP0HQ6VtucbkMNygpGlBEUM=",
"owner": "andreymatin",
"repo": "scss-reset",
"rev": "0cf50e27a4e95e9bb5b1715eedf9c54dee1a5a91",
"type": "github"
},
"original": {
"owner": "andreymatin",
"repo": "scss-reset",
"type": "github"
}
},
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -277,11 +488,11 @@
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
"lastModified": 1715035358, "lastModified": 1716400300,
"narHash": "sha256-RY6kqhpCPa/q3vbqt3iYRyjO3hJz9KZnshMjbpPon8o=", "narHash": "sha256-0lMkIk9h3AzOHs1dCL9RXvvN4PM8VBKb+cyGsqOKa4c=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "893e3df091f6838f4f9d71c61ab079d5c5dedbd1", "rev": "b549832718b8946e875c016a4785d204fcfc2e53",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -15,9 +15,14 @@
url = "github:Mic92/sops-nix"; url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-on-droid = {
url = "github:nix-community/nix-on-droid/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = inputs@{ nixpkgs, home-manager, lanzaboote, sops-nix, ... }: { outputs = inputs@{ nixpkgs, home-manager, lanzaboote, sops-nix, nix-on-droid, ... }: {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
nixosConfigurations = { nixosConfigurations = {
cafe-nosecureboot = nixpkgs.lib.nixosSystem { cafe-nosecureboot = nixpkgs.lib.nixosSystem {
@@ -47,5 +52,10 @@
]; ];
}; };
}; };
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
modules = [ ./hosts/aqua/nix-on-droid.nix ];
};
}; };
} }

7
hosts/aqua/home.nix Normal file
View File

@@ -0,0 +1,7 @@
{ pkgs, ... }: {
imports = [
../default/helix.nix
../default/shell.nix
];
home.stateVersion = "23.11";
}

View File

@@ -0,0 +1,49 @@
{ config, lib, pkgs, ... }:
{
# Simply install just the packages
environment.packages = with pkgs; [
helix # or some other editor, e.g. nano or neovim
ouch
fd
diffutils
nh
binutils
coreutils
gawk
#tzdata
hostname
man
git
rage
terminus-nerdfont
ripgrep
#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 = "23.11";
# Set up nix for flakes
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
user.shell = "${pkgs.fish}/bin/fish";
terminal.font = "${pkgs.terminus-nerdfont}/share/fonts/truetype/NerdFonts/TerminessNerdFont-Regular.ttf";
# Set your time zone
# time.timeZone = "Europe/Berlin";
home-manager.config = ./home.nix;
}