feat: flake-compat

This commit is contained in:
Oskar Manhart 2024-10-22 20:49:32 +02:00
parent 509a782a4a
commit 9d455ba753
5 changed files with 82 additions and 19 deletions

View File

@ -7,10 +7,12 @@
"style_override_for_suffix": { "style_override_for_suffix": {
".yaml": "POUND_STYLE", ".yaml": "POUND_STYLE",
".ps1": "POUND_STYLE", ".ps1": "POUND_STYLE",
".nix": "POUND_STYLE",
".bat": "BATCH_STYLE", ".bat": "BATCH_STYLE",
"": "POUND_STYLE" "": "POUND_STYLE"
}, },
"exclude": [ "exclude": [
"flake.lock",
"^\\.[^/]+", "^\\.[^/]+",
"/\\.[^/]+", "/\\.[^/]+",
"^(.+)\\.(md|svg|png|reg|gif)", "^(.+)\\.(md|svg|png|reg|gif)",

View File

@ -487,6 +487,7 @@ nix profile install github:winapps-org/winapps#winapps-launcher # optional
### On NixOS using Flakes ### On NixOS using Flakes
```nix ```nix
# flake.nix
{ {
description = "My configuration"; description = "My configuration";
@ -494,38 +495,60 @@ nix profile install github:winapps-org/winapps#winapps-launcher # optional
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
winapps = { winapps = {
url = ""github:winapps-org/winapps; url = "" "github:winapps-org/winapps";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = { outputs =
nixpkgs, {
winapps, nixpkgs,
... winapps,
}: { ...
nixosConfigurations.hostname = nixpkgs.lib.nixosSystem rec { }:
system = "x86_64-linux"; {
nixosConfigurations.hostname = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [ modules = [
./configuration.nix ./configuration.nix
({pkgs, ...}: { (
environment.systemPackages = [ { pkgs, ... }:
winapps.packages.${system}.winapps {
winapps.packages.${system}.winapps-launcher # optional environment.systemPackages = [
]; winapps.packages.${system}.winapps
}) winapps.packages.${system}.winapps-launcher # optional
]; ];
}
)
];
};
}; };
};
} }
``` ```
### On NixOS without Flakes ### On NixOS without Flakes
[Flakes aren't real and they can't hurt you.](https://jade.fyi/blog/flakes-arent-real/). [Flakes aren't real and they can't hurt you.](https://jade.fyi/blog/flakes-arent-real/).
See https://wiki.nixos.org/wiki/Flakes#Using_nix_flakes_with_NixOS on how to enable Flakes on your system. However, if you still don't want to use flakes, you can use WinApps with flake-compat like:
```nix
# configuration.nix
{ ... }:
{
environment.systemPackages =
let
winapps =
(import (builtins.fetchTarball "https://github.com/winapps-org/winapps/archive/main.tar.gz"))
.packages."${system}";
in
[
winapps.winapps
winapps.winapps-launcher # optional
];
}
```
## Star History ## Star History
<a href="https://star-history.com/#winapps-org/winapps&Date"> <a href="https://star-history.com/#winapps-org/winapps&Date">

16
default.nix Normal file
View File

@ -0,0 +1,16 @@
# Copyright (c) 2024 Oskar Manhart
# All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0-or-later
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url =
lock.nodes.flake-compat.locked.url
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
) { src = ./.; }).defaultNix

15
flake.lock generated
View File

@ -1,5 +1,19 @@
{ {
"nodes": { "nodes": {
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -36,6 +50,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }

View File

@ -1,8 +1,15 @@
# Copyright (c) 2024 Oskar Manhart
# All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ {
description = "WinApps Nix packages & NixOS module"; description = "WinApps Nix packages & NixOS module";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };