Skip to content

Commit

Permalink
docs(nix): pkgs.system -> pkgs.stdenv.hostPlatform.system (#309)
Browse files Browse the repository at this point in the history
* docs(nix): `pkgs.system` -> `pkgs.stdenv.hostPlatform.system`

`pkgs.system` is not generally recommended. It's usually better to
explicitly using the "host platform" system from `pkgs.stdenv`.

This is required to support cross-compile, for example.

* docs(nix): define package in `let-in` block

* docs(nix): define `system` in `let-in` block

* docs(nix): use github-admonition for truststore note

* docs(nix): add note regarding `specialArgs`

* docs(nix): simplify version string

No need to interpolate a string into a string 😁

* docs(nix): simplify input flakeref url

This is the preferred syntax for github-based flake refs.

* docs(nix): fix typo `umu= {` -> `umu = {`
  • Loading branch information
MattSturgeon authored Dec 14, 2024
1 parent b0c0d44 commit 9ad889e
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,47 @@ If there is any problem with the flake feel free to open a bug report and tag an
If you want to add umu-launcher as a flake add this to your inputs in `flake.nix`
```nix
inputs = {
umu= {
url = "git+https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging\/nix&submodules=1";
umu = {
url = "github:Open-Wine-Components/umu-launcher?dir=packaging/nix";
inputs.nixpkgs.follows = "nixpkgs";
};
}
```
and in your `configuration.nix`
```nix
{inputs, pkgs, ... }:
let
inherit (pkgs.stdenv.hostPlatform) system;
umu = inputs.umu.packages.${system}.umu.override {
version = inputs.umu.shortRev;
truststore = true;
};
in
{
environment.systemPackages = [ (inputs.umu.packages.${pkgs.system}.umu.override {version = "${inputs.umu.shortRev}"; truststore = true;}) ];
environment.systemPackages = [ umu ];
}
```
> [!NOTE]
> truststore is an optional dependency that is enabled by default if you want to keep it that way you can remove the `truststore = true;` part
> [!NOTE]
> The example above relies on having your flake's `inputs` passed through to your nixos configuration.
> This can be done with `specialArgs` or `_module.args`, e.g:
> ```nix
> {
> # inputs omitted ...
>
> # Assign a name to the input args using @inputs
> outputs = { self, nixpkgs, ... }@inputs: {
> nixosConfiurations."your-hostname" = nixpkgs.lib.nixosSystem {
> system = "x86_64-linux";
> specialArgs = { inherit self inputs; };
> # modules omitted ...
> };
> };
> }
> ```
## Contributing
Contributions are welcome and appreciated. To get started, install [ruff](https://github.com/astral-sh/ruff) from your distribution and enable [ruff server](https://github.com/astral-sh/ruff/blob/main/crates/ruff_server/README.md) in your editor.
Expand Down

0 comments on commit 9ad889e

Please sign in to comment.